<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: autocomplete   AutoComplete.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>AutoComplete Widget&nbsp; <span class="subtitle">2.9.0</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_autocomplete.html" title="autocomplete">autocomplete</a>
                
                 &gt; AutoComplete.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
                        <div class="highlight"><pre><span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// YAHOO.widget.DataSource Backwards Compatibility</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_JSArray</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">LocalDataSource</span><span class="p">;</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_JSFunction</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">FunctionDataSource</span><span class="p">;</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_XHR</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sScriptURI</span><span class="p">,</span> <span class="nx">aSchema</span><span class="p">,</span> <span class="nx">oConfigs</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">DS</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">XHRDataSource</span><span class="p">(</span><span class="nx">sScriptURI</span><span class="p">,</span> <span class="nx">oConfigs</span><span class="p">);</span>
    <span class="nx">DS</span><span class="p">.</span><span class="nx">_aDeprecatedSchema</span> <span class="o">=</span> <span class="nx">aSchema</span><span class="p">;</span>
    <span class="k">return</span> <span class="nx">DS</span><span class="p">;</span>
<span class="p">};</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_ScriptNode</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sScriptURI</span><span class="p">,</span> <span class="nx">aSchema</span><span class="p">,</span> <span class="nx">oConfigs</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">DS</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">ScriptNodeDataSource</span><span class="p">(</span><span class="nx">sScriptURI</span><span class="p">,</span> <span class="nx">oConfigs</span><span class="p">);</span>
    <span class="nx">DS</span><span class="p">.</span><span class="nx">_aDeprecatedSchema</span> <span class="o">=</span> <span class="nx">aSchema</span><span class="p">;</span>
    <span class="k">return</span> <span class="nx">DS</span><span class="p">;</span>
<span class="p">};</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_XHR</span><span class="p">.</span><span class="nx">TYPE_JSON</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_JSON</span><span class="p">;</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_XHR</span><span class="p">.</span><span class="nx">TYPE_XML</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_XML</span><span class="p">;</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">DS_XHR</span><span class="p">.</span><span class="nx">TYPE_FLAT</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_TEXT</span><span class="p">;</span>

<span class="c1">// TODO: widget.DS_ScriptNode.scriptCallbackParam</span>



 <span class="cm">/**</span>
<span class="cm"> * The AutoComplete control provides the front-end logic for text-entry suggestion and</span>
<span class="cm"> * completion functionality.</span>
<span class="cm"> *</span>
<span class="cm"> * @module autocomplete</span>
<span class="cm"> * @requires yahoo, dom, event, datasource</span>
<span class="cm"> * @optional animation</span>
<span class="cm"> * @namespace YAHOO.widget</span>
<span class="cm"> * @title AutoComplete Widget</span>
<span class="cm"> */</span>

<span class="cm">/****************************************************************************/</span>
<span class="cm">/****************************************************************************/</span>
<span class="cm">/****************************************************************************/</span>

<span class="cm">/**</span>
<span class="cm"> * The AutoComplete class provides the customizable functionality of a plug-and-play DHTML</span>
<span class="cm"> * auto completion widget.  Some key features:</span>
<span class="cm"> * &lt;ul&gt;</span>
<span class="cm"> * &lt;li&gt;Navigate with up/down arrow keys and/or mouse to pick a selection&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;The drop down container can &quot;roll down&quot; or &quot;fly out&quot; via configurable</span>
<span class="cm"> * animation&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;UI look-and-feel customizable through CSS, including container</span>
<span class="cm"> * attributes, borders, position, fonts, etc&lt;/li&gt;</span>
<span class="cm"> * &lt;/ul&gt;</span>
<span class="cm"> *</span>
<span class="cm"> * @class AutoComplete</span>
<span class="cm"> * @constructor</span>
<span class="cm"> * @param elInput {HTMLElement} DOM element reference of an input field.</span>
<span class="cm"> * @param elInput {String} String ID of an input field.</span>
<span class="cm"> * @param elContainer {HTMLElement} DOM element reference of an existing DIV.</span>
<span class="cm"> * @param elContainer {String} String ID of an existing DIV.</span>
<span class="cm"> * @param oDataSource {YAHOO.widget.DataSource} DataSource instance.</span>
<span class="cm"> * @param oConfigs {Object} (optional) Object literal of configuration params.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elInput</span><span class="p">,</span><span class="nx">elContainer</span><span class="p">,</span><span class="nx">oDataSource</span><span class="p">,</span><span class="nx">oConfigs</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elInput</span> <span class="o">&amp;&amp;</span> <span class="nx">elContainer</span> <span class="o">&amp;&amp;</span> <span class="nx">oDataSource</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Validate DataSource</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oDataSource</span> <span class="o">&amp;&amp;</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">sendRequest</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span> <span class="o">=</span> <span class="nx">oDataSource</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not instantiate AutoComplete due to an invalid DataSource&quot;</span><span class="p">,</span> <span class="s2">&quot;error&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="c1">// YAHOO.widget.DataSource schema backwards compatibility</span>
        <span class="c1">// Converted deprecated schema into supported schema</span>
        <span class="c1">// First assume key data is held in position 0 of results array</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">key</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">schema</span> <span class="o">=</span> <span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">;</span>
        <span class="c1">// An old school schema has been defined in the deprecated DataSource constructor</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">_aDeprecatedSchema</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">aDeprecatedSchema</span> <span class="o">=</span> <span class="nx">oDataSource</span><span class="p">.</span><span class="nx">_aDeprecatedSchema</span><span class="p">;</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">aDeprecatedSchema</span><span class="p">))</span> <span class="p">{</span>
                
                <span class="k">if</span><span class="p">((</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_JSON</span><span class="p">)</span> <span class="o">||</span> 
                <span class="p">(</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_UNKNOWN</span><span class="p">))</span> <span class="p">{</span> <span class="c1">// Used to default to unknown</span>
                    <span class="c1">// Store the resultsList</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">resultsList</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                    <span class="c1">// Store the key</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">key</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
                    <span class="c1">// Only resultsList and key are defined, so grab all the data</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">fields</span> <span class="o">=</span> <span class="p">(</span><span class="nx">aDeprecatedSchema</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">)</span> <span class="o">?</span> <span class="kc">null</span> <span class="o">:</span> <span class="nx">aDeprecatedSchema</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_XML</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">resultNode</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">key</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">fields</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
                <span class="p">}</span>                
                <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_TEXT</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">recordDelim</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                    <span class="nx">schema</span><span class="p">.</span><span class="nx">fieldDelim</span> <span class="o">=</span> <span class="nx">aDeprecatedSchema</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
                <span class="p">}</span>                
                <span class="nx">oDataSource</span><span class="p">.</span><span class="nx">responseSchema</span> <span class="o">=</span> <span class="nx">schema</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
        
        <span class="c1">// Validate input element</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">inDocument</span><span class="p">(</span><span class="nx">elInput</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">elInput</span><span class="p">))</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_sName</span> <span class="o">=</span> <span class="s2">&quot;instance&quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_nIndex</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="nx">elInput</span><span class="p">;</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">elInput</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_sName</span> <span class="o">=</span> <span class="p">(</span><span class="nx">elInput</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> <span class="o">?</span>
                    <span class="s2">&quot;instance&quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_nIndex</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="nx">elInput</span><span class="p">.</span><span class="nx">id</span><span class="o">:</span>
                    <span class="s2">&quot;instance&quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_nIndex</span><span class="p">;</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span> <span class="o">=</span> <span class="nx">elInput</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">,</span> <span class="s2">&quot;yui-ac-input&quot;</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not instantiate AutoComplete due to an invalid input element&quot;</span><span class="p">,</span> <span class="s2">&quot;error&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="c1">// Validate container element</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">inDocument</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">))</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="nx">elContainer</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">==</span> <span class="s2">&quot;none&quot;</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;The container may not display properly if display is set to \&quot;none\&quot; in CSS&quot;</span><span class="p">,</span> <span class="s2">&quot;warn&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="p">}</span>
            
            <span class="c1">// For skinning</span>
            <span class="kd">var</span> <span class="nx">elParent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
            <span class="kd">var</span> <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elParent</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">elTag</span> <span class="o">==</span> <span class="s2">&quot;div&quot;</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">elParent</span><span class="p">,</span> <span class="s2">&quot;yui-ac&quot;</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not find the wrapper element for skinning&quot;</span><span class="p">,</span> <span class="s2">&quot;warn&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not instantiate AutoComplete due to an invalid container element&quot;</span><span class="p">,</span> <span class="s2">&quot;error&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="c1">// Default applyLocalFilter setting is to enable for local sources</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">dataType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_LOCAL</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">applyLocalFilter</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="c1">// Set any config params passed in to override defaults</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oConfigs</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oConfigs</span><span class="p">.</span><span class="nx">constructor</span> <span class="o">==</span> <span class="nb">Object</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">sConfig</span> <span class="k">in</span> <span class="nx">oConfigs</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">sConfig</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">[</span><span class="nx">sConfig</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oConfigs</span><span class="p">[</span><span class="nx">sConfig</span><span class="p">];</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span>

        <span class="c1">// Initialization sequence</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_initContainerEl</span><span class="p">();</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_initProps</span><span class="p">();</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_initListEl</span><span class="p">();</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_initContainerHelperEls</span><span class="p">();</span>

        <span class="c1">// Set up events</span>
        <span class="kd">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">elTextbox</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">;</span>

        <span class="c1">// Dom events</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="s2">&quot;keyup&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onTextboxKeyUp</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="s2">&quot;keydown&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onTextboxKeyDown</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="s2">&quot;focus&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onTextboxFocus</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="s2">&quot;blur&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onTextboxBlur</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span><span class="s2">&quot;mouseover&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onContainerMouseover</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span><span class="s2">&quot;mouseout&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onContainerMouseout</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span><span class="s2">&quot;click&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onContainerClick</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span><span class="s2">&quot;scroll&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onContainerScroll</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span><span class="s2">&quot;resize&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onContainerResize</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="s2">&quot;keypress&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onTextboxKeyPress</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nb">window</span><span class="p">,</span><span class="s2">&quot;unload&quot;</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onWindowUnload</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">);</span>

        <span class="c1">// Custom events</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">textboxFocusEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;textboxFocus&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">textboxKeyEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;textboxKey&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;dataRequest&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestCancelEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;dataRequestCancel&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataReturnEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;dataReturn&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataErrorEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;dataError&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">containerPopulateEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;containerPopulate&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">containerExpandEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;containerExpand&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">typeAheadEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;typeAhead&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemMouseOverEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;itemMouseOver&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemMouseOutEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;itemMouseOut&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowToEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;itemArrowTo&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowFromEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;itemArrowFrom&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemSelectEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;itemSelect&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">unmatchedItemSelectEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;unmatchedItemSelect&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">selectionEnforceEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;selectionEnforce&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">containerCollapseEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;containerCollapse&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">textboxBlurEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;textboxBlur&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">textboxChangeEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">(</span><span class="s2">&quot;textboxChange&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
        
        <span class="c1">// Finish up</span>
        <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s2">&quot;autocomplete&quot;</span><span class="p">,</span><span class="s2">&quot;off&quot;</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_nIndex</span><span class="o">++</span><span class="p">;</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;AutoComplete initialized&quot;</span><span class="p">,</span><span class="s2">&quot;info&quot;</span><span class="p">,</span><span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
    <span class="c1">// Required arguments were not found</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not instantiate AutoComplete due invalid arguments&quot;</span><span class="p">,</span> <span class="s2">&quot;error&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Public member variables</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * The DataSource object that encapsulates the data used for auto completion.</span>
<span class="cm"> * This object should be an inherited object from YAHOO.widget.DataSource.</span>
<span class="cm"> *</span>
<span class="cm"> * @property dataSource</span>
<span class="cm"> * @type YAHOO.widget.DataSource</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">dataSource</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * By default, results from local DataSources will pass through the filterResults</span>
<span class="cm"> * method to apply a client-side matching algorithm. </span>
<span class="cm"> * </span>
<span class="cm"> * @property applyLocalFilter</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true for local arrays and json, otherwise false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">applyLocalFilter</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * When applyLocalFilter is true, the local filtering algorthim can have case sensitivity</span>
<span class="cm"> * enabled. </span>
<span class="cm"> * </span>
<span class="cm"> * @property queryMatchCase</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryMatchCase</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * When applyLocalFilter is true, results can  be locally filtered to return</span>
<span class="cm"> * matching strings that &quot;contain&quot; the query string rather than simply &quot;start with&quot;</span>
<span class="cm"> * the query string.</span>
<span class="cm"> * </span>
<span class="cm"> * @property queryMatchContains</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryMatchContains</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Enables query subset matching. When the DataSource&#39;s cache is enabled and queryMatchSubset is</span>
<span class="cm"> * true, substrings of queries will return matching cached results. For</span>
<span class="cm"> * instance, if the first query is for &quot;abc&quot; susequent queries that start with</span>
<span class="cm"> * &quot;abc&quot;, like &quot;abcd&quot;, will be queried against the cache, and not the live data</span>
<span class="cm"> * source. Recommended only for DataSources that return comprehensive results</span>
<span class="cm"> * for queries with very few characters.</span>
<span class="cm"> *</span>
<span class="cm"> * @property queryMatchSubset</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> *</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryMatchSubset</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Number of characters that must be entered before querying for results. A negative value</span>
<span class="cm"> * effectively turns off the widget. A value of 0 allows queries of null or empty string</span>
<span class="cm"> * values.</span>
<span class="cm"> *</span>
<span class="cm"> * @property minQueryLength</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 1</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">minQueryLength</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Maximum number of results to display in results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property maxResultsDisplayed</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 10</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Number of seconds to delay before submitting a query request.  If a query</span>
<span class="cm"> * request is received before a previous one has completed its delay, the</span>
<span class="cm"> * previous request is cancelled and the new request is set to the delay. If </span>
<span class="cm"> * typeAhead is also enabled, this value must always be less than the typeAheadDelay</span>
<span class="cm"> * in order to avoid certain race conditions. </span>
<span class="cm"> *</span>
<span class="cm"> * @property queryDelay</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 0.2</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryDelay</span> <span class="o">=</span> <span class="mf">0.2</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * If typeAhead is true, number of seconds to delay before updating input with</span>
<span class="cm"> * typeAhead value. In order to prevent certain race conditions, this value must</span>
<span class="cm"> * always be greater than the queryDelay.</span>
<span class="cm"> *</span>
<span class="cm"> * @property typeAheadDelay</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 0.5</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">typeAheadDelay</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * When IME usage is detected or interval detection is explicitly enabled,</span>
<span class="cm"> * AutoComplete will detect the input value at the given interval and send a</span>
<span class="cm"> * query if the value has changed.</span>
<span class="cm"> *</span>
<span class="cm"> * @property queryInterval</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 500</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryInterval</span> <span class="o">=</span> <span class="mi">500</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Class name of a highlighted item within results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property highlightClassName</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @default &quot;yui-ac-highlight&quot;</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">highlightClassName</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-highlight&quot;</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Class name of a pre-highlighted item within results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property prehighlightClassName</span>
<span class="cm"> * @type String</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">prehighlightClassName</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Query delimiter. A single character separator for multiple delimited</span>
<span class="cm"> * selections. Multiple delimiter characteres may be defined as an array of</span>
<span class="cm"> * strings. A null value or empty string indicates that query results cannot</span>
<span class="cm"> * be delimited. This feature is not recommended if you need forceSelection to</span>
<span class="cm"> * be true.</span>
<span class="cm"> *</span>
<span class="cm"> * @property delimChar</span>
<span class="cm"> * @type String | String[]</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">delimChar</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the first item in results container should be automatically highlighted</span>
<span class="cm"> * on expand.</span>
<span class="cm"> *</span>
<span class="cm"> * @property autoHighlight</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">autoHighlight</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * If autohighlight is enabled, whether or not the input field should be automatically updated</span>
<span class="cm"> * with the first query result as the user types, auto-selecting the substring portion</span>
<span class="cm"> * of the first result that the user has not yet typed.</span>
<span class="cm"> *</span>
<span class="cm"> * @property typeAhead</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">typeAhead</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not to animate the expansion/collapse of the results container in the</span>
<span class="cm"> * horizontal direction.</span>
<span class="cm"> *</span>
<span class="cm"> * @property animHoriz</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">animHoriz</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not to animate the expansion/collapse of the results container in the</span>
<span class="cm"> * vertical direction.</span>
<span class="cm"> *</span>
<span class="cm"> * @property animVert</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">animVert</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Speed of container expand/collapse animation, in seconds..</span>
<span class="cm"> *</span>
<span class="cm"> * @property animSpeed</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 0.3</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">animSpeed</span> <span class="o">=</span> <span class="mf">0.3</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not to force the user&#39;s selection to match one of the query</span>
<span class="cm"> * results. Enabling this feature essentially transforms the input field into a</span>
<span class="cm"> * &amp;lt;select&amp;gt; field. This feature is not recommended with delimiter character(s)</span>
<span class="cm"> * defined.</span>
<span class="cm"> *</span>
<span class="cm"> * @property forceSelection</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">forceSelection</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not to allow browsers to cache user-typed input in the input</span>
<span class="cm"> * field. Disabling this feature will prevent the widget from setting the</span>
<span class="cm"> * autocomplete=&quot;off&quot; on the input field. When autocomplete=&quot;off&quot;</span>
<span class="cm"> * and users click the back button after form submission, user-typed input can</span>
<span class="cm"> * be prefilled by the browser from its cache. This caching of user input may</span>
<span class="cm"> * not be desired for sensitive data, such as credit card numbers, in which</span>
<span class="cm"> * case, implementers should consider setting allowBrowserAutocomplete to false.</span>
<span class="cm"> *</span>
<span class="cm"> * @property allowBrowserAutocomplete</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">allowBrowserAutocomplete</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Enabling this feature prevents the toggling of the container to a collapsed state.</span>
<span class="cm"> * Setting to true does not automatically trigger the opening of the container.</span>
<span class="cm"> * Implementers are advised to pre-load the container with an explicit &quot;sendQuery()&quot; call.   </span>
<span class="cm"> *</span>
<span class="cm"> * @property alwaysShowContainer</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">alwaysShowContainer</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not to use an iFrame to layer over Windows form elements in</span>
<span class="cm"> * IE. Set to true only when the results container will be on top of a</span>
<span class="cm"> * &amp;lt;select&amp;gt; field in IE and thus exposed to the IE z-index bug (i.e.,</span>
<span class="cm"> * 5.5 &lt; IE &lt; 7).</span>
<span class="cm"> *</span>
<span class="cm"> * @property useIFrame</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">useIFrame</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the results container should have a shadow.</span>
<span class="cm"> *</span>
<span class="cm"> * @property useShadow</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">useShadow</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the input field should be updated with selections.</span>
<span class="cm"> *</span>
<span class="cm"> * @property suppressInputUpdate</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default false</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">suppressInputUpdate</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * For backward compatibility to pre-2.6.0 formatResults() signatures, setting</span>
<span class="cm"> * resultsTypeList to true will take each object literal result returned by</span>
<span class="cm"> * DataSource and flatten into an array.  </span>
<span class="cm"> *</span>
<span class="cm"> * @property resultTypeList</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">resultTypeList</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * For XHR DataSources, AutoComplete will automatically insert a &quot;?&quot; between the server URI and </span>
<span class="cm"> * the &quot;query&quot; param/value pair. To prevent this behavior, implementers should</span>
<span class="cm"> * set this value to false. To more fully customize the query syntax, implementers</span>
<span class="cm"> * should override the generateRequest() method.</span>
<span class="cm"> *</span>
<span class="cm"> * @property queryQuestionMark</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">queryQuestionMark</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * If true, before each time the container expands, the container element will be</span>
<span class="cm"> * positioned to snap to the bottom-left corner of the input element. If</span>
<span class="cm"> * autoSnapContainer is set to false, this positioning will not be done.  </span>
<span class="cm"> *</span>
<span class="cm"> * @property autoSnapContainer</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @default true</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">autoSnapContainer</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Public methods</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

 <span class="cm">/**</span>
<span class="cm"> * Public accessor to the unique name of the AutoComplete instance.</span>
<span class="cm"> *</span>
<span class="cm"> * @method toString</span>
<span class="cm"> * @return {String} Unique name of the AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toString</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="s2">&quot;AutoComplete &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sName</span><span class="p">;</span>
<span class="p">};</span>

 <span class="cm">/**</span>
<span class="cm"> * Returns DOM reference to input element.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getInputEl</span>
<span class="cm"> * @return {HTMLELement} DOM reference to input element.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getInputEl</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">;</span>
<span class="p">};</span>

 <span class="cm">/**</span>
<span class="cm"> * Returns DOM reference to container element.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getContainerEl</span>
<span class="cm"> * @return {HTMLELement} DOM reference to container element.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getContainerEl</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">;</span>
<span class="p">};</span>

 <span class="cm">/**</span>
<span class="cm"> * Returns true if widget instance is currently active.</span>
<span class="cm"> *</span>
<span class="cm"> * @method isFocused</span>
<span class="cm"> * @return {Boolean} Returns true if widget instance is currently active.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">isFocused</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_bFocused</span><span class="p">;</span>
<span class="p">};</span>

 <span class="cm">/**</span>
<span class="cm"> * Returns true if container is in an expanded state, false otherwise.</span>
<span class="cm"> *</span>
<span class="cm"> * @method isContainerOpen</span>
<span class="cm"> * @return {Boolean} Returns true if container is in an expanded state, false otherwise.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">isContainerOpen</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Public accessor to the &amp;lt;ul&amp;gt; element that displays query results within the results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getListEl</span>
<span class="cm"> * @return {HTMLElement[]} Reference to &amp;lt;ul&amp;gt; element within the results container.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getListEl</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Public accessor to the matching string associated with a given &amp;lt;li&amp;gt; result.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getListItemMatch</span>
<span class="cm"> * @param elListItem {HTMLElement} Reference to &amp;lt;LI&amp;gt; element.</span>
<span class="cm"> * @return {String} Matching string.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getListItemMatch</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">return</span> <span class="kc">null</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Public accessor to the result data associated with a given &amp;lt;li&amp;gt; result.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getListItemData</span>
<span class="cm"> * @param elListItem {HTMLElement} Reference to &amp;lt;LI&amp;gt; element.</span>
<span class="cm"> * @return {Object} Result data.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getListItemData</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">.</span><span class="nx">_oResultData</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_oResultData</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">return</span> <span class="kc">null</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Public accessor to the index of the associated with a given &amp;lt;li&amp;gt; result.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getListItemIndex</span>
<span class="cm"> * @param elListItem {HTMLElement} Reference to &amp;lt;LI&amp;gt; element.</span>
<span class="cm"> * @return {Number} Index.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getListItemIndex</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">return</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">return</span> <span class="kc">null</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Sets HTML markup for the results container header. This markup will be</span>
<span class="cm"> * inserted within a &amp;lt;div&amp;gt; tag with a class of &quot;yui-ac-hd&quot;.</span>
<span class="cm"> *</span>
<span class="cm"> * @method setHeader</span>
<span class="cm"> * @param sHeader {HTML} HTML markup for results container header.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">setHeader</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sHeader</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elHeader</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elHeader</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elHeader</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">sHeader</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elHeader</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">sHeader</span><span class="p">;</span>
            <span class="nx">elHeader</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">elHeader</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
            <span class="nx">elHeader</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Sets HTML markup for the results container footer. This markup will be</span>
<span class="cm"> * inserted within a &amp;lt;div&amp;gt; tag with a class of &quot;yui-ac-ft&quot;.</span>
<span class="cm"> *</span>
<span class="cm"> * @method setFooter</span>
<span class="cm"> * @param sFooter {HTML} HTML markup for results container footer.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">setFooter</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sFooter</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elFooter</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elFooter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elFooter</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">sFooter</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">elFooter</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">sFooter</span><span class="p">;</span>
                <span class="nx">elFooter</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">elFooter</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
            <span class="nx">elFooter</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Sets HTML markup for the results container body. This markup will be</span>
<span class="cm"> * inserted within a &amp;lt;div&amp;gt; tag with a class of &quot;yui-ac-bd&quot;.</span>
<span class="cm"> *</span>
<span class="cm"> * @method setBody</span>
<span class="cm"> * @param sBody {HTML} HTML markup for results container body.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">setBody</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sBody</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elBody</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elBody</span><span class="p">;</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">elBody</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">sBody</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elBody</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">sBody</span><span class="p">;</span>
            <span class="nx">elBody</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">elBody</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
            <span class="nx">elBody</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm">* A function that converts an AutoComplete query into a request value which is then</span>
<span class="cm">* passed to the DataSource&#39;s sendRequest method in order to retrieve data for </span>
<span class="cm">* the query. By default, returns a String with the syntax: &quot;query={query}&quot;</span>
<span class="cm">* Implementers can customize this method for custom request syntaxes.</span>
<span class="cm">* </span>
<span class="cm">* @method generateRequest</span>
<span class="cm">* @param sQuery {String} Query string</span>
<span class="cm">* @return {MIXED} Request</span>
<span class="cm">*/</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">generateRequest</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">dataType</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">dataType</span><span class="p">;</span>
    
    <span class="c1">// Transform query string in to a request for remote data</span>
    <span class="c1">// By default, local data doesn&#39;t need a transformation, just passes along the query as is.</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">dataType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_XHR</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// By default, XHR GET requests look like &quot;{scriptURI}?{scriptQueryParam}={sQuery}&amp;{scriptQueryAppend}&quot;</span>
        <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">connMethodPost</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">sQuery</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">queryQuestionMark</span> <span class="o">?</span> <span class="s2">&quot;?&quot;</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryParam</span> <span class="o">||</span> <span class="s2">&quot;query&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;=&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> 
                <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span> <span class="o">?</span> <span class="p">(</span><span class="s2">&quot;&amp;&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span><span class="p">)</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">);</span>        
        <span class="p">}</span>
        <span class="c1">// By default, XHR POST bodies are sent to the {scriptURI} like &quot;{scriptQueryParam}={sQuery}&amp;{scriptQueryAppend}&quot;</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">sQuery</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryParam</span> <span class="o">||</span> <span class="s2">&quot;query&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;=&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> 
                <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span> <span class="o">?</span> <span class="p">(</span><span class="s2">&quot;&amp;&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span><span class="p">)</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="c1">// By default, remote script node requests look like &quot;{scriptURI}&amp;{scriptCallbackParam}={callbackString}&amp;{scriptQueryParam}={sQuery}&amp;{scriptQueryAppend}&quot;</span>
    <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">dataType</span> <span class="o">===</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">DataSourceBase</span><span class="p">.</span><span class="nx">TYPE_SCRIPTNODE</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">sQuery</span> <span class="o">=</span> <span class="s2">&quot;&amp;&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryParam</span> <span class="o">||</span> <span class="s2">&quot;query&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;=&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> 
            <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span> <span class="o">?</span> <span class="p">(</span><span class="s2">&quot;&amp;&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">scriptQueryAppend</span><span class="p">)</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">);</span>    
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">sQuery</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Makes query request to the DataSource.</span>
<span class="cm"> *</span>
<span class="cm"> * @method sendQuery</span>
<span class="cm"> * @param sQuery {String} Query string.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">sendQuery</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Activate focus for a new interaction</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_bFocused</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
    
    <span class="c1">// Adjust programatically sent queries to look like they were input by user</span>
    <span class="c1">// when delimiters are enabled</span>
    <span class="kd">var</span> <span class="nx">newQuery</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="o">?</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">:</span> <span class="nx">sQuery</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_sendQuery</span><span class="p">(</span><span class="nx">newQuery</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Snaps container to bottom-left corner of input element</span>
<span class="cm"> *</span>
<span class="cm"> * @method snapContainer</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">snapContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">oTextbox</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">,</span>
        <span class="nx">pos</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">getXY</span><span class="p">(</span><span class="nx">oTextbox</span><span class="p">);</span>
    <span class="nx">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">oTextbox</span><span class="p">).</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="mi">2</span><span class="p">;</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">setXY</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">,</span><span class="nx">pos</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Expands container.</span>
<span class="cm"> *</span>
<span class="cm"> * @method expandContainer</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">expandContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Collapses container.</span>
<span class="cm"> *</span>
<span class="cm"> * @method collapseContainer</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">collapseContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Clears entire list of suggestions.</span>
<span class="cm"> *</span>
<span class="cm"> * @method clearList</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">clearList</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">allItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">,</span>
        <span class="nx">i</span><span class="o">=</span><span class="nx">allItems</span><span class="p">.</span><span class="nx">length</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span>
    <span class="k">for</span><span class="p">(;</span> <span class="nx">i</span><span class="o">&gt;-</span><span class="mi">1</span><span class="p">;</span> <span class="nx">i</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
          <span class="nx">allItems</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles subset matching for when queryMatchSubset is enabled.</span>
<span class="cm"> *</span>
<span class="cm"> * @method getSubsetMatches</span>
<span class="cm"> * @param sQuery {String} Query string.</span>
<span class="cm"> * @return {Object} oParsedResponse or null. </span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getSubsetMatches</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">subQuery</span><span class="p">,</span> <span class="nx">oCachedResponse</span><span class="p">,</span> <span class="nx">subRequest</span><span class="p">;</span>
    <span class="c1">// Loop through substrings of each cached element&#39;s query property...</span>
    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="nx">sQuery</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&gt;=</span> <span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span> <span class="p">;</span> <span class="nx">i</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">subRequest</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">generateRequest</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nx">i</span><span class="p">));</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">subQuery</span><span class="p">,</span> <span class="nx">subRequest</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Searching for query subset \&quot;&quot;</span> <span class="o">+</span> <span class="nx">subQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot; in cache&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        
        <span class="c1">// If a substring of the query is found in the cache</span>
        <span class="nx">oCachedResponse</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">getCachedResponse</span><span class="p">(</span><span class="nx">subRequest</span><span class="p">);</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oCachedResponse</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Found match for query subset \&quot;&quot;</span> <span class="o">+</span> <span class="nx">subQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot;: &quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">dump</span><span class="p">(</span><span class="nx">oCachedResponse</span><span class="p">),</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">filterResults</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">,</span> <span class="p">[</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oCachedResponse</span><span class="p">,</span> <span class="nx">oCachedResponse</span><span class="p">,</span> <span class="p">{</span><span class="nx">scope</span><span class="o">:</span><span class="k">this</span><span class="p">}]);</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Did not find subset match for query subset \&quot;&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot;&quot;</span> <span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="k">return</span> <span class="kc">null</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Executed by DataSource (within DataSource scope via doBeforeParseData()) to</span>
<span class="cm"> * handle responseStripAfter cleanup.</span>
<span class="cm"> *</span>
<span class="cm"> * @method preparseRawResponse</span>
<span class="cm"> * @param sQuery {String} Query string.</span>
<span class="cm"> * @return {Object} oParsedResponse or null. </span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">preparseRawResponse</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oRequest</span><span class="p">,</span> <span class="nx">oFullResponse</span><span class="p">,</span> <span class="nx">oCallback</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">nEnd</span> <span class="o">=</span> <span class="p">((</span><span class="k">this</span><span class="p">.</span><span class="nx">responseStripAfter</span> <span class="o">!==</span> <span class="s2">&quot;&quot;</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oFullResponse</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">))</span> <span class="o">?</span>
        <span class="nx">oFullResponse</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">responseStripAfter</span><span class="p">)</span> <span class="o">:</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">nEnd</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oFullResponse</span> <span class="o">=</span> <span class="nx">oFullResponse</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nx">nEnd</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">return</span> <span class="nx">oFullResponse</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Executed by DataSource (within DataSource scope via doBeforeCallback()) to</span>
<span class="cm"> * filter results through a simple client-side matching algorithm. </span>
<span class="cm"> *</span>
<span class="cm"> * @method filterResults</span>
<span class="cm"> * @param sQuery {String} Original request.</span>
<span class="cm"> * @param oFullResponse {Object} Full response object.</span>
<span class="cm"> * @param oParsedResponse {Object} Parsed response object.</span>
<span class="cm"> * @param oCallback {Object} Callback object. </span>
<span class="cm"> * @return {Object} Filtered response object.</span>
<span class="cm"> */</span>

<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">filterResults</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oFullResponse</span><span class="p">,</span> <span class="nx">oParsedResponse</span><span class="p">,</span> <span class="nx">oCallback</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// If AC has passed a query string value back to itself, grab it</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oCallback</span> <span class="o">&amp;&amp;</span> <span class="nx">oCallback</span><span class="p">.</span><span class="nx">argument</span> <span class="o">&amp;&amp;</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isValue</span><span class="p">(</span><span class="nx">oCallback</span><span class="p">.</span><span class="nx">argument</span><span class="p">.</span><span class="nx">query</span><span class="p">))</span> <span class="p">{</span>
        <span class="nx">sQuery</span> <span class="o">=</span> <span class="nx">oCallback</span><span class="p">.</span><span class="nx">argument</span><span class="p">.</span><span class="nx">query</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// Only if a query string is available to match against</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">sQuery</span> <span class="o">&amp;&amp;</span> <span class="nx">sQuery</span> <span class="o">!==</span> <span class="s2">&quot;&quot;</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// First make a copy of the oParseResponse</span>
        <span class="nx">oParsedResponse</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_cloneObject</span><span class="p">(</span><span class="nx">oParsedResponse</span><span class="p">);</span>
        
        <span class="kd">var</span> <span class="nx">oAC</span> <span class="o">=</span> <span class="nx">oCallback</span><span class="p">.</span><span class="nx">scope</span><span class="p">,</span>
            <span class="nx">oDS</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span>
            <span class="nx">allResults</span> <span class="o">=</span> <span class="nx">oParsedResponse</span><span class="p">.</span><span class="nx">results</span><span class="p">,</span> <span class="c1">// the array of results</span>
            <span class="nx">filteredResults</span> <span class="o">=</span> <span class="p">[],</span> <span class="c1">// container for filtered results,</span>
            <span class="nx">nMax</span> <span class="o">=</span> <span class="nx">oAC</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span><span class="p">,</span> <span class="c1">// max to find</span>
            <span class="nx">bMatchCase</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oDS</span><span class="p">.</span><span class="nx">queryMatchCase</span> <span class="o">||</span> <span class="nx">oAC</span><span class="p">.</span><span class="nx">queryMatchCase</span><span class="p">),</span> <span class="c1">// backward compat</span>
            <span class="nx">bMatchContains</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oDS</span><span class="p">.</span><span class="nx">queryMatchContains</span> <span class="o">||</span> <span class="nx">oAC</span><span class="p">.</span><span class="nx">queryMatchContains</span><span class="p">);</span> <span class="c1">// backward compat</span>
            
        <span class="c1">// Loop through each result object...</span>
        <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="nx">len</span><span class="o">=</span><span class="nx">allResults</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">oResult</span> <span class="o">=</span> <span class="nx">allResults</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

            <span class="c1">// Grab the data to match against from the result object...</span>
            <span class="kd">var</span> <span class="nx">sResult</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
            
            <span class="c1">// Result object is a simple string already</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="p">{</span>
                <span class="nx">sResult</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="c1">// Result object is an array of strings</span>
            <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="p">{</span>
                <span class="nx">sResult</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
            
            <span class="p">}</span>
            <span class="c1">// Result object is an object literal of strings</span>
            <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">)</span> <span class="p">{</span>
                <span class="kd">var</span> <span class="nx">key</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">key</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                <span class="nx">sResult</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span>
            <span class="p">}</span>
            <span class="c1">// Backwards compatibility</span>
            <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">sResult</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">key</span><span class="p">];</span>
            <span class="p">}</span>
            
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">sResult</span><span class="p">))</span> <span class="p">{</span>
                
                <span class="kd">var</span> <span class="nx">sKeyIndex</span> <span class="o">=</span> <span class="p">(</span><span class="nx">bMatchCase</span><span class="p">)</span> <span class="o">?</span>
                <span class="nx">sResult</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nb">decodeURIComponent</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">))</span> <span class="o">:</span>
                <span class="nx">sResult</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">indexOf</span><span class="p">(</span><span class="nb">decodeURIComponent</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">).</span><span class="nx">toLowerCase</span><span class="p">());</span>

                <span class="c1">// A STARTSWITH match is when the query is found at the beginning of the key string...</span>
                <span class="k">if</span><span class="p">((</span><span class="o">!</span><span class="nx">bMatchContains</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">sKeyIndex</span> <span class="o">===</span> <span class="mi">0</span><span class="p">))</span> <span class="o">||</span>
                <span class="c1">// A CONTAINS match is when the query is found anywhere within the key string...</span>
                <span class="p">(</span><span class="nx">bMatchContains</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">sKeyIndex</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)))</span> <span class="p">{</span>
                    <span class="c1">// Stash the match</span>
                    <span class="nx">filteredResults</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">oResult</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
            
            <span class="c1">// Filter no more if maxResultsDisplayed is reached</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">len</span><span class="o">&gt;</span><span class="nx">nMax</span> <span class="o">&amp;&amp;</span> <span class="nx">filteredResults</span><span class="p">.</span><span class="nx">length</span><span class="o">===</span><span class="nx">nMax</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="nx">oParsedResponse</span><span class="p">.</span><span class="nx">results</span> <span class="o">=</span> <span class="nx">filteredResults</span><span class="p">;</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Filtered &quot;</span> <span class="o">+</span> <span class="nx">filteredResults</span><span class="p">.</span><span class="nx">length</span> <span class="o">+</span> <span class="s2">&quot; results against query \&quot;&quot;</span>  <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot;: &quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">dump</span><span class="p">(</span><span class="nx">filteredResults</span><span class="p">),</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Did not filter results against query&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">oParsedResponse</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles response for display. This is the callback function method passed to</span>
<span class="cm"> * YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are</span>
<span class="cm"> * returned to the AutoComplete instance.</span>
<span class="cm"> *</span>
<span class="cm"> * @method handleResponse</span>
<span class="cm"> * @param sQuery {String} Original request.</span>
<span class="cm"> * @param oResponse {Object} &lt;a href=&quot;http://developer.yahoo.com/yui/datasource/#ds_oParsedResponse&quot;&gt;Response object&lt;/a&gt;.</span>
<span class="cm"> * @param oPayload {MIXED} (optional) Additional argument(s)</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">handleResponse</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="nx">oPayload</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">((</span><span class="k">this</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sName</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_populateList</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="nx">oPayload</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Overridable method called before container is loaded with result data.</span>
<span class="cm"> *</span>
<span class="cm"> * @method doBeforeLoadData</span>
<span class="cm"> * @param sQuery {String} Original request.</span>
<span class="cm"> * @param oResponse {Object} &lt;a href=&quot;http://developer.yahoo.com/yui/datasource/#ds_oParsedResponse&quot;&gt;Response object&lt;/a&gt;.</span>
<span class="cm"> * @param oPayload {MIXED} (optional) Additional argument(s)</span>
<span class="cm"> * @return {Boolean} Return true to continue loading data, false to cancel.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">doBeforeLoadData</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="nx">oPayload</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="kc">true</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Overridable method that returns HTML markup for one result to be populated</span>
<span class="cm"> * as innerHTML of an &amp;lt;LI&amp;gt; element. </span>
<span class="cm"> *</span>
<span class="cm"> * @method formatResult</span>
<span class="cm"> * @param oResultData {Object} Result data object.</span>
<span class="cm"> * @param sQuery {String} The corresponding query string.</span>
<span class="cm"> * @param sResultMatch {HTMLElement} The current query string. </span>
<span class="cm"> * @return {HTML} HTML markup of formatted result data.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">formatResult</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oResultData</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">sResultMatch</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">sMarkup</span> <span class="o">=</span> <span class="p">(</span><span class="nx">sResultMatch</span><span class="p">)</span> <span class="o">?</span> <span class="nx">sResultMatch</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
    <span class="k">return</span> <span class="nx">sMarkup</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * An alternative to the formatResult() method, escapes the result data before</span>
<span class="cm"> * inserting into DOM. Implementers should point to this method when accessing</span>
<span class="cm"> * data from third-party sources, from user input, or from otherwise</span>
<span class="cm"> * untrustworthy sources:</span>
<span class="cm"> * myAutoComplete.formatResult = myAutoComplete.formatEscapedResult;</span>
<span class="cm"> *</span>
<span class="cm"> * @method formatEscapedResult</span>
<span class="cm"> * @param oResultData {Object} Result data object.</span>
<span class="cm"> * @param sQuery {String} The corresponding query string.</span>
<span class="cm"> * @param sResultMatch {HTMLElement} The current query string.</span>
<span class="cm"> * @return {String} Formatted result data.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">formatEscapedResult</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oResultData</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">sResultMatch</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">sResult</span> <span class="o">=</span> <span class="p">(</span><span class="nx">sResultMatch</span><span class="p">)</span> <span class="o">?</span> <span class="nx">sResultMatch</span> <span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
    <span class="k">return</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">escapeHTML</span><span class="p">(</span><span class="nx">sResult</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Overridable method called before container expands allows implementers to access data</span>
<span class="cm"> * and DOM elements.</span>
<span class="cm"> *</span>
<span class="cm"> * @method doBeforeExpandContainer</span>
<span class="cm"> * @param elTextbox {HTMLElement} The text input box.</span>
<span class="cm"> * @param elContainer {HTMLElement} The container element.</span>
<span class="cm"> * @param sQuery {String} The query string.</span>
<span class="cm"> * @param aResults {Object[]}  An array of query results.</span>
<span class="cm"> * @return {Boolean} Return true to continue expanding container, false to cancel the expand.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">doBeforeExpandContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span> <span class="nx">elContainer</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">aResults</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="kc">true</span><span class="p">;</span>
<span class="p">};</span>


<span class="cm">/**</span>
<span class="cm"> * Nulls out the entire AutoComplete instance and related objects, removes attached</span>
<span class="cm"> * event listeners, and clears out DOM elements inside the container. After</span>
<span class="cm"> * calling this method, the instance reference should be expliclitly nulled by</span>
<span class="cm"> * implementer, as in myAutoComplete = null. Use with caution!</span>
<span class="cm"> *</span>
<span class="cm"> * @method destroy</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">instanceName</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">();</span>
    <span class="kd">var</span> <span class="nx">elInput</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">elContainer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">;</span>

    <span class="c1">// Unhook custom events</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">textboxFocusEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">textboxKeyEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">dataReturnEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">dataErrorEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">containerPopulateEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">containerExpandEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">typeAheadEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemMouseOverEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemMouseOutEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowToEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowFromEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemSelectEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">unmatchedItemSelectEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">selectionEnforceEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">containerCollapseEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">textboxBlurEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">textboxChangeEvent</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>

    <span class="c1">// Unhook DOM events</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">elInput</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">elContainer</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

    <span class="c1">// Remove DOM elements</span>
    <span class="nx">elContainer</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>

    <span class="c1">// Null out objects</span>
    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">key</span> <span class="k">in</span> <span class="k">this</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">key</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">[</span><span class="nx">key</span><span class="p">]</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;AutoComplete instance destroyed: &quot;</span> <span class="o">+</span> <span class="nx">instanceName</span><span class="p">);</span>
<span class="p">};</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Public events</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the input field receives focus.</span>
<span class="cm"> *</span>
<span class="cm"> * @event textboxFocusEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">textboxFocusEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the input field receives key input.</span>
<span class="cm"> *</span>
<span class="cm"> * @event textboxKeyEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {Number} The keycode number.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">textboxKeyEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the AutoComplete instance makes a request to the DataSource.</span>
<span class="cm"> * </span>
<span class="cm"> * @event dataRequestEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The query string.</span>
<span class="cm"> * @param args[2] {Object} The request.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">dataRequestEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the AutoComplete request to the DataSource is canceled.</span>
<span class="cm"> *</span>
<span class="cm"> * @event dataRequestCancelEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The query string.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">dataRequestCancelEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the AutoComplete instance receives query results from the data</span>
<span class="cm"> * source.</span>
<span class="cm"> *</span>
<span class="cm"> * @event dataReturnEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The query string.</span>
<span class="cm"> * @param args[2] {Object[]} Results array.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">dataReturnEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the AutoComplete instance does not receive query results from the</span>
<span class="cm"> * DataSource due to an error.</span>
<span class="cm"> *</span>
<span class="cm"> * @event dataErrorEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The query string.</span>
<span class="cm"> * @param args[2] {Object} The response object, if available.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">dataErrorEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the results container is populated.</span>
<span class="cm"> *</span>
<span class="cm"> * @event containerPopulateEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">containerPopulateEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the results container is expanded.</span>
<span class="cm"> *</span>
<span class="cm"> * @event containerExpandEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">containerExpandEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the input field has been prefilled by the type-ahead</span>
<span class="cm"> * feature. </span>
<span class="cm"> *</span>
<span class="cm"> * @event typeAheadEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The query string.</span>
<span class="cm"> * @param args[2] {String} The prefill string.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">typeAheadEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when result item has been moused over.</span>
<span class="cm"> *</span>
<span class="cm"> * @event itemMouseOverEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {HTMLElement} The &amp;lt;li&amp;gt element item moused to.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">itemMouseOverEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when result item has been moused out.</span>
<span class="cm"> *</span>
<span class="cm"> * @event itemMouseOutEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {HTMLElement} The &amp;lt;li&amp;gt; element item moused from.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">itemMouseOutEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when result item has been arrowed to. </span>
<span class="cm"> *</span>
<span class="cm"> * @event itemArrowToEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {HTMLElement} The &amp;lt;li&amp;gt; element item arrowed to.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">itemArrowToEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when result item has been arrowed away from.</span>
<span class="cm"> *</span>
<span class="cm"> * @event itemArrowFromEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0[ {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {HTMLElement} The &amp;lt;li&amp;gt; element item arrowed from.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">itemArrowFromEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when an item is selected via mouse click, ENTER key, or TAB key.</span>
<span class="cm"> *</span>
<span class="cm"> * @event itemSelectEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {HTMLElement} The selected &amp;lt;li&amp;gt; element item.</span>
<span class="cm"> * @param args[2] {Object} The data returned for the item, either as an object,</span>
<span class="cm"> * or mapped from the schema into an array.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">itemSelectEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when a user selection does not match any of the displayed result items.</span>
<span class="cm"> *</span>
<span class="cm"> * @event unmatchedItemSelectEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The selected string.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">unmatchedItemSelectEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired if forceSelection is enabled and the user&#39;s input has been cleared</span>
<span class="cm"> * because it did not match one of the returned query results.</span>
<span class="cm"> *</span>
<span class="cm"> * @event selectionEnforceEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @param args[1] {String} The cleared value (including delimiters if applicable).</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">selectionEnforceEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the results container is collapsed.</span>
<span class="cm"> *</span>
<span class="cm"> * @event containerCollapseEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">containerCollapseEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the input field loses focus.</span>
<span class="cm"> *</span>
<span class="cm"> * @event textboxBlurEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">textboxBlurEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Fired when the input field value has changed when it loses focus.</span>
<span class="cm"> *</span>
<span class="cm"> * @event textboxChangeEvent</span>
<span class="cm"> * @param type {String} Name of the event.</span>
<span class="cm"> * @param args[0] {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">textboxChangeEvent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Private member variables</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * Internal class variable to index multiple AutoComplete instances.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _nIndex</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 0</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_nIndex</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Name of AutoComplete instance.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _sName</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sName</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Text input field DOM element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elTextbox</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elTextbox</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Container DOM element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elContainer</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to content element within container element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elContent</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elContent</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to header element within content element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elHeader</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elHeader</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to body element within content element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elBody</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elBody</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to footer element within content element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elFooter</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elFooter</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to shadow element within container element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elShadow</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elShadow</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Reference to iframe element within container element.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elIFrame</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elIFrame</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the widget instance is currently active. If query results come back</span>
<span class="cm"> * but the user has already moved on, do not proceed with auto complete behavior.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _bFocused</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_bFocused</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Animation instance for container expand/collapse.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _oAnim</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_oAnim</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the results container is currently open.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _bContainerOpen</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not the mouse is currently over the results</span>
<span class="cm"> * container. This is necessary in order to prevent clicks on container items</span>
<span class="cm"> * from being text input field blur events.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _bOverContainer</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_bOverContainer</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Internal reference to &amp;lt;ul&amp;gt; elements that contains query results within the</span>
<span class="cm"> * results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elList</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elList</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/*</span>
<span class="cm"> * Array of &amp;lt;li&amp;gt; elements references that contain query results within the</span>
<span class="cm"> * results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _aListItemEls</span>
<span class="cm"> * @type HTMLElement[]</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="c1">//YAHOO.widget.AutoComplete.prototype._aListItemEls = null;</span>

<span class="cm">/**</span>
<span class="cm"> * Number of &amp;lt;li&amp;gt; elements currently displayed in results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _nDisplayedItems</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_nDisplayedItems</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>

<span class="cm">/*</span>
<span class="cm"> * Internal count of &amp;lt;li&amp;gt; elements displayed and hidden in results container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _maxResultsDisplayed</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="c1">//YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0;</span>

<span class="cm">/**</span>
<span class="cm"> * Current query string</span>
<span class="cm"> *</span>
<span class="cm"> * @property _sCurQuery</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sCurQuery</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Selections from previous queries (for saving delimited queries).</span>
<span class="cm"> *</span>
<span class="cm"> * @property _sPastSelections</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @default &quot;&quot; </span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sPastSelections</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Stores initial input value used to determine if textboxChangeEvent should be fired.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _sInitInputValue</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sInitInputValue</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Pointer to the currently highlighted &amp;lt;li&amp;gt; element in the container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elCurListItem</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elCurListItem</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Pointer to the currently pre-highlighted &amp;lt;li&amp;gt; element in the container.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _elCurPrehighlightItem</span>
<span class="cm"> * @type HTMLElement</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_elCurPrehighlightItem</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not an item has been selected since the container was populated</span>
<span class="cm"> * with results. Reset to false by _populateList, and set to true when item is</span>
<span class="cm"> * selected.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _bItemSelected</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_bItemSelected</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Key code of the last key pressed in textbox.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _nKeyCode</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Delay timeout ID.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _nDelayID</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_nDelayID</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * TypeAhead delay timeout ID.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _nTypeAheadDelayID</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Src to iFrame used when useIFrame = true. Supports implementations over SSL</span>
<span class="cm"> * as well.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _iFrameSrc</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_iFrameSrc</span> <span class="o">=</span> <span class="s2">&quot;javascript:false;&quot;</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * For users typing via certain IMEs, queries must be triggered by intervals,</span>
<span class="cm"> * since key events yet supported across all browsers for all IMEs.</span>
<span class="cm"> *</span>
<span class="cm"> * @property _queryInterval</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_queryInterval</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Internal tracker to last known textbox value, used to determine whether or not</span>
<span class="cm"> * to trigger a query via interval for certain IME users.</span>
<span class="cm"> *</span>
<span class="cm"> * @event _sLastTextboxValue</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sLastTextboxValue</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Private methods</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * Updates and validates latest public config properties.</span>
<span class="cm"> *</span>
<span class="cm"> * @method __initProps</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_initProps</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="c1">// Correct any invalid values</span>
    <span class="kd">var</span> <span class="nx">minQueryLength</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">minQueryLength</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="kd">var</span> <span class="nx">maxResultsDisplayed</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">maxResultsDisplayed</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">maxResultsDisplayed</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="kd">var</span> <span class="nx">queryDelay</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">queryDelay</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">queryDelay</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">queryDelay</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">queryDelay</span> <span class="o">=</span> <span class="mf">0.2</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="kd">var</span> <span class="nx">typeAheadDelay</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">typeAheadDelay</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">typeAheadDelay</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">typeAheadDelay</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">typeAheadDelay</span> <span class="o">=</span> <span class="mf">0.2</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="kd">var</span> <span class="nx">delimChar</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">delimChar</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">delimChar</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span> <span class="o">=</span> <span class="p">[</span><span class="nx">delimChar</span><span class="p">];</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">delimChar</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="kd">var</span> <span class="nx">animSpeed</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">animSpeed</span><span class="p">;</span>
    <span class="k">if</span><span class="p">((</span><span class="k">this</span><span class="p">.</span><span class="nx">animHoriz</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">animVert</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Anim</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">animSpeed</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">animSpeed</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">animSpeed</span> <span class="o">=</span> <span class="mf">0.3</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_oAnim</span> <span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_oAnim</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Anim</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">,</span> <span class="p">{},</span> <span class="k">this</span><span class="p">.</span><span class="nx">animSpeed</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_oAnim</span><span class="p">.</span><span class="nx">duration</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">animSpeed</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">forceSelection</span> <span class="o">&amp;&amp;</span> <span class="nx">delimChar</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;The forceSelection feature has been enabled with delimChar defined.&quot;</span><span class="p">,</span><span class="s2">&quot;warn&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Initializes the results container helpers if they are enabled and do</span>
<span class="cm"> * not exist</span>
<span class="cm"> *</span>
<span class="cm"> * @method _initContainerHelperEls</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_initContainerHelperEls</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">useShadow</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_elShadow</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elShadow</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">);</span>
        <span class="nx">elShadow</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-shadow&quot;</span><span class="p">;</span>
        <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elShadow</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elShadow</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">useIFrame</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_elIFrame</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elIFrame</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;iframe&quot;</span><span class="p">);</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">src</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_iFrameSrc</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">frameBorder</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">scrolling</span> <span class="o">=</span> <span class="s2">&quot;no&quot;</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">position</span> <span class="o">=</span> <span class="s2">&quot;absolute&quot;</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">padding</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">tabIndex</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">role</span> <span class="o">=</span> <span class="s2">&quot;presentation&quot;</span><span class="p">;</span>
        <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">title</span> <span class="o">=</span> <span class="s2">&quot;Presentational iframe shim&quot;</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elIFrame</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elIFrame</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Initializes the results container once at object creation</span>
<span class="cm"> *</span>
<span class="cm"> * @method _initContainerEl</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_initContainerEl</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">,</span> <span class="s2">&quot;yui-ac-container&quot;</span><span class="p">);</span>
    
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// The elContent div is assigned DOM listeners and </span>
        <span class="c1">// helps size the iframe and shadow properly</span>
        <span class="kd">var</span> <span class="nx">elContent</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">);</span>
        <span class="nx">elContent</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-content&quot;</span><span class="p">;</span>
        <span class="nx">elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elContent</span><span class="p">);</span>

        <span class="kd">var</span> <span class="nx">elHeader</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">);</span>
        <span class="nx">elHeader</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-hd&quot;</span><span class="p">;</span>
        <span class="nx">elHeader</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elHeader</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elHeader</span><span class="p">);</span>

        <span class="kd">var</span> <span class="nx">elBody</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">);</span>
        <span class="nx">elBody</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-bd&quot;</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elBody</span><span class="p">);</span>

        <span class="kd">var</span> <span class="nx">elFooter</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">);</span>
        <span class="nx">elFooter</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-ac-ft&quot;</span><span class="p">;</span>
        <span class="nx">elFooter</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elFooter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elFooter</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not initialize the container&quot;</span><span class="p">,</span><span class="s2">&quot;warn&quot;</span><span class="p">,</span><span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Clears out contents of container body and creates up to</span>
<span class="cm"> * YAHOO.widget.AutoComplete#maxResultsDisplayed &amp;lt;li&amp;gt; elements in an</span>
<span class="cm"> * &amp;lt;ul&amp;gt; element.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _initListEl</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_initListEl</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">nListLength</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span><span class="p">,</span>
        <span class="nx">elList</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span> <span class="o">||</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;ul&quot;</span><span class="p">),</span>
        <span class="nx">elListItem</span><span class="p">;</span>
    
    <span class="k">while</span><span class="p">(</span><span class="nx">elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="nx">nListLength</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">elListItem</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;li&quot;</span><span class="p">);</span>
        <span class="nx">elListItem</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
        <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span> <span class="o">=</span> <span class="nx">elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        <span class="nx">elList</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elBody</span><span class="p">;</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">elBody</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        <span class="nx">elBody</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span> <span class="o">=</span> <span class="nx">elBody</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">elList</span><span class="p">);</span>
    <span class="p">}</span>
    
    <span class="k">this</span><span class="p">.</span><span class="nx">_elBody</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Focuses input field.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _focus</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_focus</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="c1">// http://developer.mozilla.org/en/docs/index.php?title=Key-navigable_custom_DHTML_widgets</span>
    <span class="kd">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    <span class="nx">setTimeout</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">try</span> <span class="p">{</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
        <span class="p">}</span>
        <span class="k">catch</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
        <span class="p">}</span>
    <span class="p">},</span><span class="mi">0</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Enables interval detection for IME support.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _enableIntervalDetection</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_enableIntervalDetection</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_queryInterval</span> <span class="o">&amp;&amp;</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">queryInterval</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_queryInterval</span> <span class="o">=</span> <span class="nx">setInterval</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_onInterval</span><span class="p">();</span> <span class="p">},</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">queryInterval</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Interval set&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Enables interval detection for a less performant but brute force mechanism to</span>
<span class="cm"> * detect input values at an interval set by queryInterval and send queries if</span>
<span class="cm"> * input value has changed. Needed to support right-click+paste or shift+insert</span>
<span class="cm"> * edge cases. Please note that intervals are cleared at the end of each interaction,</span>
<span class="cm"> * so enableIntervalDetection must be called for each new interaction. The</span>
<span class="cm"> * recommended approach is to call it in response to textboxFocusEvent.</span>
<span class="cm"> *</span>
<span class="cm"> * @method enableIntervalDetection</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">enableIntervalDetection</span> <span class="o">=</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_enableIntervalDetection</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Enables query triggers based on text input detection by intervals (rather</span>
<span class="cm"> * than by key events).</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onInterval</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onInterval</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">currValue</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">lastValue</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sLastTextboxValue</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">currValue</span> <span class="o">!=</span> <span class="nx">lastValue</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_sLastTextboxValue</span> <span class="o">=</span> <span class="nx">currValue</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_sendQuery</span><span class="p">(</span><span class="nx">currValue</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Cancels text input detection by intervals.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _clearInterval</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_clearInterval</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_queryInterval</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">clearInterval</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_queryInterval</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_queryInterval</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Interval cleared&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not key is functional or should be ignored. Note that the right</span>
<span class="cm"> * arrow key is NOT an ignored key since it triggers queries for certain intl</span>
<span class="cm"> * charsets.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _isIgnoreKey</span>
<span class="cm"> * @param nKeycode {Number} Code of key pressed.</span>
<span class="cm"> * @return {Boolean} True if key should be ignored, false otherwise.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_isIgnoreKey</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">nKeyCode</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">((</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">9</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">13</span><span class="p">)</span>  <span class="o">||</span> <span class="c1">// tab, enter</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">16</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">17</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// shift, ctl</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">&gt;=</span> <span class="mi">18</span> <span class="o">&amp;&amp;</span> <span class="nx">nKeyCode</span> <span class="o">&lt;=</span> <span class="mi">20</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// alt, pause/break,caps lock</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">27</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// esc</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">&gt;=</span> <span class="mi">33</span> <span class="o">&amp;&amp;</span> <span class="nx">nKeyCode</span> <span class="o">&lt;=</span> <span class="mi">35</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// page up,page down,end</span>
            <span class="cm">/*(nKeyCode &gt;= 36 &amp;&amp; nKeyCode &lt;= 38) || // home,left,up</span>
<span class="cm">            (nKeyCode == 40) || // down*/</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">&gt;=</span> <span class="mi">36</span> <span class="o">&amp;&amp;</span> <span class="nx">nKeyCode</span> <span class="o">&lt;=</span> <span class="mi">40</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// home,left,up, right, down</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">&gt;=</span> <span class="mi">44</span> <span class="o">&amp;&amp;</span> <span class="nx">nKeyCode</span> <span class="o">&lt;=</span> <span class="mi">45</span><span class="p">)</span> <span class="o">||</span> <span class="c1">// print screen,insert</span>
            <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">229</span><span class="p">)</span> <span class="c1">// Bug 2041973: Korean XP fires 2 keyup events, the key and 229</span>
        <span class="p">)</span> <span class="p">{</span> 
        <span class="k">return</span> <span class="kc">true</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Makes query request to the DataSource.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _sendQuery</span>
<span class="cm"> * @param sQuery {String} Query string.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_sendQuery</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Widget has been effectively turned off</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Property minQueryLength is less than 0&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="c1">// Delimiter has been enabled</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">extraction</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_extractQuery</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
        <span class="c1">// Here is the query itself</span>
        <span class="nx">sQuery</span> <span class="o">=</span> <span class="nx">extraction</span><span class="p">.</span><span class="nx">query</span><span class="p">;</span>
        <span class="c1">// ...and save the rest of the string for later</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_sPastSelections</span> <span class="o">=</span> <span class="nx">extraction</span><span class="p">.</span><span class="nx">previous</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// Don&#39;t search queries that are too short</span>
    <span class="k">if</span><span class="p">((</span><span class="nx">sQuery</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">sQuery</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span><span class="p">))</span> <span class="o">||</span> <span class="p">(</span><span class="o">!</span><span class="nx">sQuery</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">minQueryLength</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nDelayID</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">clearTimeout</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nDelayID</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Query \&quot;&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot; is too short&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="nx">sQuery</span> <span class="o">=</span> <span class="nb">encodeURIComponent</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_nDelayID</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>    <span class="c1">// Reset timeout ID because request is being made</span>
    
    <span class="c1">// Subset matching</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">queryMatchSubset</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">queryMatchSubset</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// backward compat</span>
        <span class="kd">var</span> <span class="nx">oResponse</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getSubsetMatches</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oResponse</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">handleResponse</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="p">{</span><span class="nx">query</span><span class="o">:</span> <span class="nx">sQuery</span><span class="p">});</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
    
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">responseStripAfter</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">doBeforeParseData</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">preparseRawResponse</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">applyLocalFilter</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">doBeforeCallback</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">filterResults</span><span class="p">;</span>
    <span class="p">}</span>
    
    <span class="kd">var</span> <span class="nx">sRequest</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">generateRequest</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
    
    <span class="k">if</span><span class="p">(</span><span class="nx">sRequest</span> <span class="o">!==</span> <span class="kc">undefined</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">sRequest</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Sending query \&quot;&quot;</span> <span class="o">+</span> <span class="nx">sRequest</span> <span class="o">+</span> <span class="s2">&quot;\&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">sendRequest</span><span class="p">(</span><span class="nx">sRequest</span><span class="p">,</span> <span class="p">{</span>
                <span class="nx">success</span> <span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleResponse</span><span class="p">,</span>
                <span class="nx">failure</span> <span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleResponse</span><span class="p">,</span>
                <span class="nx">scope</span>   <span class="o">:</span> <span class="k">this</span><span class="p">,</span>
                <span class="nx">argument</span><span class="o">:</span> <span class="p">{</span>
                    <span class="nx">query</span><span class="o">:</span> <span class="nx">sQuery</span>
                <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataRequestCancelEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Canceled query \&quot;&quot;</span> <span class="o">+</span> <span class="nx">sQuery</span> <span class="o">+</span> <span class="s2">&quot;\&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Populates the given &amp;lt;li&amp;gt; element with return value from formatResult().</span>
<span class="cm"> *</span>
<span class="cm"> * @method _populateListItem</span>
<span class="cm"> * @param elListItem {HTMLElement} The LI element.</span>
<span class="cm"> * @param oResult {Object} The result object.</span>
<span class="cm"> * @param sCurQuery {String} The query string.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_populateListItem</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">,</span> <span class="nx">oResult</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">elListItem</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">formatResult</span><span class="p">(</span><span class="nx">oResult</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Populates the array of &amp;lt;li&amp;gt; elements in the container with query</span>
<span class="cm"> * results.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _populateList</span>
<span class="cm"> * @param sQuery {String} Original request.</span>
<span class="cm"> * @param oResponse {Object} &lt;a href=&quot;http://developer.yahoo.com/yui/datasource/#ds_oParsedResponse&quot;&gt;Response object&lt;/a&gt;.</span>
<span class="cm"> * @param oPayload {MIXED} (optional) Additional argument(s)</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_populateList</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="nx">oPayload</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Clear previous timeout</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">clearTimeout</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span><span class="p">);</span>
    <span class="p">}</span>
        
    <span class="nx">sQuery</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oPayload</span> <span class="o">&amp;&amp;</span> <span class="nx">oPayload</span><span class="p">.</span><span class="nx">query</span><span class="p">)</span> <span class="o">?</span> <span class="nx">oPayload</span><span class="p">.</span><span class="nx">query</span> <span class="o">:</span> <span class="nx">sQuery</span><span class="p">;</span>
    
    <span class="c1">// Pass data through abstract method for any transformations</span>
    <span class="kd">var</span> <span class="nx">ok</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">doBeforeLoadData</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">,</span> <span class="nx">oPayload</span><span class="p">);</span>

    <span class="c1">// Data is ok</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">ok</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oResponse</span><span class="p">.</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataReturnEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">.</span><span class="nx">results</span><span class="p">);</span>
        
        <span class="c1">// Continue only if instance is still active (i.e., user hasn&#39;t already moved on)</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_bFocused</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Store state for this interaction</span>
            <span class="kd">var</span> <span class="nx">sCurQuery</span> <span class="o">=</span> <span class="nb">decodeURIComponent</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span> <span class="o">=</span> <span class="nx">sCurQuery</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_bItemSelected</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
        
            <span class="kd">var</span> <span class="nx">allResults</span> <span class="o">=</span> <span class="nx">oResponse</span><span class="p">.</span><span class="nx">results</span><span class="p">,</span>
                <span class="nx">nItemsToShow</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">(</span><span class="nx">allResults</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span><span class="k">this</span><span class="p">.</span><span class="nx">maxResultsDisplayed</span><span class="p">),</span>
                <span class="nx">sMatchKey</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">)</span> <span class="o">?</span> 
                    <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">key</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
            
            <span class="k">if</span><span class="p">(</span><span class="nx">nItemsToShow</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
                <span class="c1">// Make sure container and helpers are ready to go</span>
                <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_elList</span> <span class="o">||</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="nx">nItemsToShow</span><span class="p">))</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_initListEl</span><span class="p">();</span>
                <span class="p">}</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_initContainerHelperEls</span><span class="p">();</span>
                
                <span class="kd">var</span> <span class="nx">allListItemEls</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">;</span>
                <span class="c1">// Fill items with data from the bottom up</span>
                <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItemsToShow</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
                    <span class="kd">var</span> <span class="nx">elListItem</span> <span class="o">=</span> <span class="nx">allListItemEls</span><span class="p">[</span><span class="nx">i</span><span class="p">],</span>
                    <span class="nx">oResult</span> <span class="o">=</span> <span class="nx">allResults</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
                    
                    <span class="c1">// Backward compatibility</span>
                    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">resultTypeList</span><span class="p">)</span> <span class="p">{</span>
                        <span class="c1">// Results need to be converted back to an array</span>
                        <span class="kd">var</span> <span class="nx">aResult</span> <span class="o">=</span> <span class="p">[];</span>
                        <span class="c1">// Match key is first</span>
                        <span class="nx">aResult</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="o">?</span> <span class="nx">oResult</span> <span class="o">:</span> <span class="nx">oResult</span><span class="p">[</span><span class="nx">sMatchKey</span><span class="p">]</span> <span class="o">||</span> <span class="nx">oResult</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">key</span><span class="p">];</span>
                        <span class="c1">// Add additional data to the result array</span>
                        <span class="kd">var</span> <span class="nx">fields</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">dataSource</span><span class="p">.</span><span class="nx">responseSchema</span><span class="p">.</span><span class="nx">fields</span><span class="p">;</span>
                        <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">fields</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">fields</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">))</span> <span class="p">{</span>
                            <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">k</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="nx">len</span><span class="o">=</span><span class="nx">fields</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">k</span><span class="o">&lt;</span><span class="nx">len</span><span class="p">;</span> <span class="nx">k</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
                                <span class="nx">aResult</span><span class="p">[</span><span class="nx">aResult</span><span class="p">.</span><span class="nx">length</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">[</span><span class="nx">fields</span><span class="p">[</span><span class="nx">k</span><span class="p">].</span><span class="nx">key</span> <span class="o">||</span> <span class="nx">fields</span><span class="p">[</span><span class="nx">k</span><span class="p">]];</span>
                            <span class="p">}</span>
                        <span class="p">}</span>
                        <span class="c1">// No specific fields defined, so pass along entire data object</span>
                        <span class="k">else</span> <span class="p">{</span>
                            <span class="c1">// Already an array</span>
                            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="p">{</span>
                                <span class="nx">aResult</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">;</span>
                            <span class="p">}</span>
                            <span class="c1">// Simple string </span>
                            <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="p">{</span>
                                <span class="nx">aResult</span> <span class="o">=</span> <span class="p">[</span><span class="nx">oResult</span><span class="p">];</span>
                            <span class="p">}</span>
                            <span class="c1">// Object</span>
                            <span class="k">else</span> <span class="p">{</span>
                                <span class="nx">aResult</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">;</span>
                            <span class="p">}</span>
                        <span class="p">}</span>
                        <span class="nx">oResult</span> <span class="o">=</span> <span class="nx">aResult</span><span class="p">;</span>
                    <span class="p">}</span>

                    <span class="c1">// The matching value, including backward compatibility for array format and safety net</span>
                    <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span> <span class="o">=</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="o">?</span> <span class="nx">oResult</span> <span class="o">:</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">oResult</span><span class="p">))</span> <span class="o">?</span> <span class="nx">oResult</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">:</span> <span class="p">(</span><span class="nx">oResult</span><span class="p">[</span><span class="nx">sMatchKey</span><span class="p">]</span> <span class="o">||</span> <span class="s2">&quot;&quot;</span><span class="p">);</span>
                    <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_oResultData</span> <span class="o">=</span> <span class="nx">oResult</span><span class="p">;</span> <span class="c1">// Additional data</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_populateListItem</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">,</span> <span class="nx">oResult</span><span class="p">,</span> <span class="nx">sCurQuery</span><span class="p">);</span>
                    <span class="nx">elListItem</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
                <span class="p">}</span>
        
                <span class="c1">// Clear out extraneous items</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">nItemsToShow</span> <span class="o">&lt;</span> <span class="nx">allListItemEls</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
                    <span class="kd">var</span> <span class="nx">extraListItem</span><span class="p">;</span>
                    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">j</span> <span class="o">=</span> <span class="nx">allListItemEls</span><span class="p">.</span><span class="nx">length</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span> <span class="nx">j</span> <span class="o">&gt;=</span> <span class="nx">nItemsToShow</span><span class="p">;</span> <span class="nx">j</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">extraListItem</span> <span class="o">=</span> <span class="nx">allListItemEls</span><span class="p">[</span><span class="nx">j</span><span class="p">];</span>
                        <span class="nx">extraListItem</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
                    <span class="p">}</span>
                <span class="p">}</span>
                
                <span class="k">this</span><span class="p">.</span><span class="nx">_nDisplayedItems</span> <span class="o">=</span> <span class="nx">nItemsToShow</span><span class="p">;</span>
                
                <span class="k">this</span><span class="p">.</span><span class="nx">containerPopulateEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">allResults</span><span class="p">);</span>
                
                <span class="c1">// Highlight the first item</span>
                <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">autoHighlight</span><span class="p">)</span> <span class="p">{</span>
                    <span class="kd">var</span> <span class="nx">elFirstListItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">;</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elFirstListItem</span><span class="p">,</span><span class="s2">&quot;to&quot;</span><span class="p">);</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowToEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">elFirstListItem</span><span class="p">);</span>
                    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Arrowed to first item&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_typeAhead</span><span class="p">(</span><span class="nx">elFirstListItem</span><span class="p">,</span><span class="nx">sQuery</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="c1">// Unhighlight any previous time</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span><span class="s2">&quot;from&quot;</span><span class="p">);</span>
                <span class="p">}</span>
        
                <span class="c1">// Pre-expansion stuff</span>
                <span class="nx">ok</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_doBeforeExpandContainer</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">allResults</span><span class="p">);</span>
                
                <span class="c1">// Expand the container</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="nx">ok</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
            <span class="p">}</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Container populated with &quot;</span> <span class="o">+</span> <span class="nx">nItemsToShow</span> <span class="o">+</span>  <span class="s2">&quot; list items&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="c1">// Error</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">dataErrorEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">oResponse</span><span class="p">);</span>
    <span class="p">}</span>
        
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Could not populate list&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>    
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Called before container expands, by default snaps container to the</span>
<span class="cm"> * bottom-left corner of the input element, then calls public overrideable method.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _doBeforeExpandContainer</span>
<span class="cm"> * @param elTextbox {HTMLElement} The text input box.</span>
<span class="cm"> * @param elContainer {HTMLElement} The container element.</span>
<span class="cm"> * @param sQuery {String} The query string.</span>
<span class="cm"> * @param aResults {Object[]}  An array of query results.</span>
<span class="cm"> * @return {Boolean} Return true to continue expanding container, false to cancel the expand.</span>
<span class="cm"> * @private </span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_doBeforeExpandContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span> <span class="nx">elContainer</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">aResults</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">autoSnapContainer</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">snapContainer</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">doBeforeExpandContainer</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span> <span class="nx">elContainer</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">,</span> <span class="nx">aResults</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * When forceSelection is true and the user attempts</span>
<span class="cm"> * leave the text input box without selecting an item from the query results,</span>
<span class="cm"> * the user selection is cleared.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _clearSelection</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_clearSelection</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">extraction</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="o">?</span> <span class="k">this</span><span class="p">.</span><span class="nx">_extractQuery</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">)</span> <span class="o">:</span>
            <span class="p">{</span><span class="nx">previous</span><span class="o">:</span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="nx">query</span><span class="o">:</span><span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">};</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">extraction</span><span class="p">.</span><span class="nx">previous</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">selectionEnforceEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">extraction</span><span class="p">.</span><span class="nx">query</span><span class="p">);</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Selection enforced&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Whether or not user-typed value in the text input box matches any of the</span>
<span class="cm"> * query results.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _textMatchesOption</span>
<span class="cm"> * @return {HTMLElement} Matching list item element if user-input text matches</span>
<span class="cm"> * a result, null otherwise.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_textMatchesOption</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elMatch</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="k">this</span><span class="p">.</span><span class="nx">_nDisplayedItems</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">elListItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
        <span class="kd">var</span> <span class="nx">sMatch</span> <span class="o">=</span> <span class="p">(</span><span class="s2">&quot;&quot;</span> <span class="o">+</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">).</span><span class="nx">toLowerCase</span><span class="p">();</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">sMatch</span> <span class="o">==</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">())</span> <span class="p">{</span>
            <span class="nx">elMatch</span> <span class="o">=</span> <span class="nx">elListItem</span><span class="p">;</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="k">return</span><span class="p">(</span><span class="nx">elMatch</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Updates in the text input box with the first query result as the user types,</span>
<span class="cm"> * selecting the substring that the user has not typed.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _typeAhead</span>
<span class="cm"> * @param elListItem {HTMLElement} The &amp;lt;li&amp;gt; element item whose data populates the input field.</span>
<span class="cm"> * @param sQuery {String} Query string.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_typeAhead</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">,</span> <span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Don&#39;t typeAhead if turned off or is backspace</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">typeAhead</span> <span class="o">||</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">==</span> <span class="mi">8</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kd">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span>
        <span class="nx">elTextbox</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">;</span>
        
    <span class="c1">// Only if text selection is supported</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">.</span><span class="nx">setSelectionRange</span> <span class="o">||</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">createTextRange</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Set and store timeout for this typeahead</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span> <span class="o">=</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
                <span class="c1">// Select the portion of text that the user has not typed</span>
                <span class="kd">var</span> <span class="nx">nStart</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="c1">// any saved queries plus what user has typed</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_updateValue</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">);</span>
                <span class="kd">var</span> <span class="nx">nEnd</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectText</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="nx">nStart</span><span class="p">,</span><span class="nx">nEnd</span><span class="p">);</span>
                <span class="kd">var</span> <span class="nx">sPrefill</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">nStart</span><span class="p">,</span><span class="nx">nEnd</span><span class="p">);</span>
                <span class="c1">// Bug 2528552: Store as a selection</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sCurQuery</span> <span class="o">=</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">;</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">typeAheadEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">,</span><span class="nx">sQuery</span><span class="p">,</span><span class="nx">sPrefill</span><span class="p">);</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Typeahead occured with prefill string \&quot;&quot;</span> <span class="o">+</span> <span class="nx">sPrefill</span> <span class="o">+</span> <span class="s2">&quot;\&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="p">},(</span><span class="k">this</span><span class="p">.</span><span class="nx">typeAheadDelay</span><span class="o">*</span><span class="mi">1000</span><span class="p">));</span>            
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Selects text in the input field.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _selectText</span>
<span class="cm"> * @param elTextbox {HTMLElement} Text input box element in which to select text.</span>
<span class="cm"> * @param nStart {Number} Starting index of text string to select.</span>
<span class="cm"> * @param nEnd {Number} Ending index of text selection.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_selectText</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span> <span class="nx">nStart</span><span class="p">,</span> <span class="nx">nEnd</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">.</span><span class="nx">setSelectionRange</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// For Mozilla</span>
        <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">setSelectionRange</span><span class="p">(</span><span class="nx">nStart</span><span class="p">,</span><span class="nx">nEnd</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">.</span><span class="nx">createTextRange</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// For IE</span>
        <span class="kd">var</span> <span class="nx">oTextRange</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">createTextRange</span><span class="p">();</span>
        <span class="nx">oTextRange</span><span class="p">.</span><span class="nx">moveStart</span><span class="p">(</span><span class="s2">&quot;character&quot;</span><span class="p">,</span> <span class="nx">nStart</span><span class="p">);</span>
        <span class="nx">oTextRange</span><span class="p">.</span><span class="nx">moveEnd</span><span class="p">(</span><span class="s2">&quot;character&quot;</span><span class="p">,</span> <span class="nx">nEnd</span><span class="o">-</span><span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span>
        <span class="nx">oTextRange</span><span class="p">.</span><span class="nx">select</span><span class="p">();</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">select</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Extracts rightmost query from delimited string.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _extractQuery</span>
<span class="cm"> * @param sQuery {String} String to parse</span>
<span class="cm"> * @return {Object} Object literal containing properties &quot;query&quot; and &quot;previous&quot;.  </span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_extractQuery</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">aDelimChar</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">,</span>
        <span class="nx">nDelimIndex</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
        <span class="nx">nNewIndex</span><span class="p">,</span> <span class="nx">nQueryStart</span><span class="p">,</span>
        <span class="nx">i</span> <span class="o">=</span> <span class="nx">aDelimChar</span><span class="p">.</span><span class="nx">length</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span>
        <span class="nx">sPrevious</span><span class="p">;</span>
        
    <span class="c1">// Loop through all possible delimiters and find the rightmost one in the query</span>
    <span class="c1">// A &quot; &quot; may be a false positive if they are defined as delimiters AND</span>
    <span class="c1">// are used to separate delimited queries</span>
    <span class="k">for</span><span class="p">(;</span> <span class="nx">i</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">nNewIndex</span> <span class="o">=</span> <span class="nx">sQuery</span><span class="p">.</span><span class="nx">lastIndexOf</span><span class="p">(</span><span class="nx">aDelimChar</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">nNewIndex</span> <span class="o">&gt;</span> <span class="nx">nDelimIndex</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">nDelimIndex</span> <span class="o">=</span> <span class="nx">nNewIndex</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="c1">// If we think the last delimiter is a space (&quot; &quot;), make sure it is NOT</span>
    <span class="c1">// a false positive by also checking the char directly before it</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">aDelimChar</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot; &quot;</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">j</span> <span class="o">=</span> <span class="nx">aDelimChar</span><span class="p">.</span><span class="nx">length</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span> <span class="nx">j</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">j</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">[</span><span class="nx">nDelimIndex</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="nx">aDelimChar</span><span class="p">[</span><span class="nx">j</span><span class="p">])</span> <span class="p">{</span>
                <span class="nx">nDelimIndex</span><span class="o">--</span><span class="p">;</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="c1">// A delimiter has been found in the query so extract the latest query from past selections</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">nDelimIndex</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">nQueryStart</span> <span class="o">=</span> <span class="nx">nDelimIndex</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
        <span class="c1">// Trim any white space from the beginning...</span>
        <span class="k">while</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="nx">nQueryStart</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot; &quot;</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">nQueryStart</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="c1">// ...and save the rest of the string for later</span>
        <span class="nx">sPrevious</span> <span class="o">=</span> <span class="nx">sQuery</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nx">nQueryStart</span><span class="p">);</span>
        <span class="c1">// Here is the query itself</span>
        <span class="nx">sQuery</span> <span class="o">=</span> <span class="nx">sQuery</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">nQueryStart</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="c1">// No delimiter found in the query, so there are no selections from past queries</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">sPrevious</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="p">{</span>
        <span class="nx">previous</span><span class="o">:</span> <span class="nx">sPrevious</span><span class="p">,</span>
        <span class="nx">query</span><span class="o">:</span> <span class="nx">sQuery</span>
    <span class="p">};</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Syncs results container with its helpers.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _toggleContainerHelpers</span>
<span class="cm"> * @param bShow {Boolean} True if container is expanded, false if collapsed</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">width</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">offsetWidth</span> <span class="o">+</span> <span class="s2">&quot;px&quot;</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">height</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="s2">&quot;px&quot;</span><span class="p">;</span>

    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">useIFrame</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elIFrame</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elIFrame</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elIFrame</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">width</span><span class="p">;</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">height</span><span class="p">;</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">padding</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Iframe expanded&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">elIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">padding</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Iframe collapsed&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">useShadow</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elShadow</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elShadow</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elShadow</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">width</span><span class="p">;</span>
            <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">height</span><span class="p">;</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Shadow expanded&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">elShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Shadow collapsed&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Animates expansion or collapse of the container.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _toggleContainer</span>
<span class="cm"> * @param bShow {Boolean} True if container should be expanded, false if container should be collapsed</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_toggleContainer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Toggling container &quot;</span> <span class="o">+</span> <span class="p">((</span><span class="nx">bShow</span><span class="p">)</span> <span class="o">?</span> <span class="s2">&quot;open&quot;</span> <span class="o">:</span> <span class="s2">&quot;closed&quot;</span><span class="p">),</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

    <span class="kd">var</span> <span class="nx">elContainer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContainer</span><span class="p">;</span>

    <span class="c1">// If implementer has container always open and it&#39;s already open, don&#39;t mess with it</span>
    <span class="c1">// Container is initialized with display &quot;none&quot; so it may need to be shown first time through</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">alwaysShowContainer</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>
    
    <span class="c1">// Reset states</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span><span class="s2">&quot;from&quot;</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_nDisplayedItems</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
        
        <span class="c1">// Container is already closed, so don&#39;t bother with changing the UI</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">==</span> <span class="s2">&quot;none&quot;</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="c1">// If animation is enabled...</span>
    <span class="kd">var</span> <span class="nx">oAnim</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_oAnim</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oAnim</span> <span class="o">&amp;&amp;</span> <span class="nx">oAnim</span><span class="p">.</span><span class="nx">getEl</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">animHoriz</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">animVert</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oAnim</span><span class="p">.</span><span class="nx">isAnimated</span><span class="p">())</span> <span class="p">{</span>
            <span class="nx">oAnim</span><span class="p">.</span><span class="nx">stop</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="c1">// Clone container to grab current size offscreen</span>
        <span class="kd">var</span> <span class="nx">oClone</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">cloneNode</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
        <span class="nx">elContainer</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">oClone</span><span class="p">);</span>
        <span class="nx">oClone</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">top</span> <span class="o">=</span> <span class="s2">&quot;-9000px&quot;</span><span class="p">;</span>
        <span class="nx">oClone</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="nx">oClone</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="nx">oClone</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>

        <span class="c1">// Current size of the container is the EXPANDED size</span>
        <span class="kd">var</span> <span class="nx">wExp</span> <span class="o">=</span> <span class="nx">oClone</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">hExp</span> <span class="o">=</span> <span class="nx">oClone</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>

        <span class="c1">// Calculate COLLAPSED sizes based on horiz and vert anim</span>
        <span class="kd">var</span> <span class="nx">wColl</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">animHoriz</span><span class="p">)</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="nx">wExp</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">hColl</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">animVert</span><span class="p">)</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="nx">hExp</span><span class="p">;</span>

        <span class="c1">// Set animation sizes</span>
        <span class="nx">oAnim</span><span class="p">.</span><span class="nx">attributes</span> <span class="o">=</span> <span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="o">?</span>
            <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="p">{</span> <span class="nx">to</span><span class="o">:</span> <span class="nx">wExp</span> <span class="p">},</span> <span class="nx">height</span><span class="o">:</span> <span class="p">{</span> <span class="nx">to</span><span class="o">:</span> <span class="nx">hExp</span> <span class="p">}}</span> <span class="o">:</span>
            <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="p">{</span> <span class="nx">to</span><span class="o">:</span> <span class="nx">wColl</span><span class="p">},</span> <span class="nx">height</span><span class="o">:</span> <span class="p">{</span> <span class="nx">to</span><span class="o">:</span> <span class="nx">hColl</span> <span class="p">}};</span>

        <span class="c1">// If opening anew, set to a collapsed size...</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">bShow</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">wColl</span><span class="o">+</span><span class="s2">&quot;px&quot;</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">hColl</span><span class="o">+</span><span class="s2">&quot;px&quot;</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="c1">// Else, set it to its last known size.</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">wExp</span><span class="o">+</span><span class="s2">&quot;px&quot;</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">hExp</span><span class="o">+</span><span class="s2">&quot;px&quot;</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">elContainer</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oClone</span><span class="p">);</span>
        <span class="nx">oClone</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

    	<span class="kd">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    	<span class="kd">var</span> <span class="nx">onAnimComplete</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="c1">// Finish the collapse</span>
    		<span class="nx">oAnim</span><span class="p">.</span><span class="nx">onComplete</span><span class="p">.</span><span class="nx">unsubscribeAll</span><span class="p">();</span>

            <span class="k">if</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">=</span> <span class="nx">bShow</span><span class="p">;</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">containerExpandEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">);</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Container expanded&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">=</span> <span class="nx">bShow</span><span class="p">;</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">containerCollapseEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">);</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Container collapsed&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="p">}</span>
     	<span class="p">};</span>

        <span class="c1">// Display container and animate it</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span> <span class="c1">// Bug 1424486: Be early to hide, late to show;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="nx">oAnim</span><span class="p">.</span><span class="nx">onComplete</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">onAnimComplete</span><span class="p">);</span>
        <span class="nx">oAnim</span><span class="p">.</span><span class="nx">animate</span><span class="p">();</span>
    <span class="p">}</span>
    <span class="c1">// Else don&#39;t animate, just show or hide</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">bShow</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">=</span> <span class="nx">bShow</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">containerExpandEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Container expanded&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">=</span> <span class="nx">bShow</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">containerCollapseEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Container collapsed&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
   <span class="p">}</span>

<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Toggles the highlight on or off for an item in the container, and also cleans</span>
<span class="cm"> * up highlighting of any previous item.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _toggleHighlight</span>
<span class="cm"> * @param elNewListItem {HTMLElement} The &amp;lt;li&amp;gt; element item to receive highlight behavior.</span>
<span class="cm"> * @param sType {String} Type &quot;mouseover&quot; will toggle highlight on, and &quot;mouseout&quot; will toggle highlight off.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_toggleHighlight</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="nx">sType</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">sHighlight</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">highlightClassName</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Remove highlight from old item</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span> <span class="nx">sHighlight</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
        <span class="p">}</span>
    
        <span class="k">if</span><span class="p">((</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">&quot;to&quot;</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">sHighlight</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Apply highlight to new item</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="nx">sHighlight</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span> <span class="o">=</span> <span class="nx">elNewListItem</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Toggles the pre-highlight on or off for an item in the container, and also cleans</span>
<span class="cm"> * up pre-highlighting of any previous item.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _togglePrehighlight</span>
<span class="cm"> * @param elNewListItem {HTMLElement} The &amp;lt;li&amp;gt; element item to receive highlight behavior.</span>
<span class="cm"> * @param sType {String} Type &quot;mouseover&quot; will toggle highlight on, and &quot;mouseout&quot; will toggle highlight off.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_togglePrehighlight</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="nx">sType</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">sPrehighlight</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">prehighlightClassName</span><span class="p">;</span>

    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurPrehighlightItem</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurPrehighlightItem</span><span class="p">,</span> <span class="nx">sPrehighlight</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">elNewListItem</span> <span class="o">==</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">if</span><span class="p">((</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">&quot;mouseover&quot;</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">sPrehighlight</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Apply prehighlight to new item</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="nx">sPrehighlight</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_elCurPrehighlightItem</span> <span class="o">=</span> <span class="nx">elNewListItem</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="c1">// Remove prehighlight from old item</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="nx">sPrehighlight</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Updates the text input box value with selected query result. If a delimiter</span>
<span class="cm"> * has been defined, then the value gets appended with the delimiter.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _updateValue</span>
<span class="cm"> * @param elListItem {HTMLElement} The &amp;lt;li&amp;gt; element item with which to update the value.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_updateValue</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">suppressInputUpdate</span><span class="p">)</span> <span class="p">{</span>    
        <span class="kd">var</span> <span class="nx">elTextbox</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">sDelimChar</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="o">?</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">||</span> <span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="o">:</span> <span class="kc">null</span><span class="p">;</span>
        <span class="kd">var</span> <span class="nx">sResultMatch</span> <span class="o">=</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">;</span>
    
        <span class="c1">// Calculate the new value</span>
        <span class="kd">var</span> <span class="nx">sNewValue</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">sDelimChar</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Preserve selections from past queries</span>
            <span class="nx">sNewValue</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sPastSelections</span><span class="p">;</span>
            <span class="c1">// Add new selection plus delimiter</span>
            <span class="nx">sNewValue</span> <span class="o">+=</span> <span class="nx">sResultMatch</span> <span class="o">+</span> <span class="nx">sDelimChar</span><span class="p">;</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">sDelimChar</span> <span class="o">!=</span> <span class="s2">&quot; &quot;</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">sNewValue</span> <span class="o">+=</span> <span class="s2">&quot; &quot;</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span> 
            <span class="nx">sNewValue</span> <span class="o">=</span> <span class="nx">sResultMatch</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="c1">// Update input field</span>
        <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">sNewValue</span><span class="p">;</span>
    
        <span class="c1">// Scroll to bottom of textarea if necessary</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">&quot;textarea&quot;</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">scrollHeight</span><span class="p">;</span>
        <span class="p">}</span>
    
        <span class="c1">// Move cursor to end</span>
        <span class="kd">var</span> <span class="nx">end</span> <span class="o">=</span> <span class="nx">elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_selectText</span><span class="p">(</span><span class="nx">elTextbox</span><span class="p">,</span><span class="nx">end</span><span class="p">,</span><span class="nx">end</span><span class="p">);</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span> <span class="o">=</span> <span class="nx">elListItem</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Selects a result item from the container</span>
<span class="cm"> *</span>
<span class="cm"> * @method _selectItem</span>
<span class="cm"> * @param elListItem {HTMLElement} The selected &amp;lt;li&amp;gt; element item.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_selectItem</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_bItemSelected</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_updateValue</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_sPastSelections</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_clearInterval</span><span class="p">();</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">itemSelectEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">elListItem</span><span class="p">,</span> <span class="nx">elListItem</span><span class="p">.</span><span class="nx">_oResultData</span><span class="p">);</span>
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item selected: &quot;</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">dump</span><span class="p">(</span><span class="nx">elListItem</span><span class="p">.</span><span class="nx">_oResultData</span><span class="p">),</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * If an item is highlighted in the container, the right arrow key jumps to the</span>
<span class="cm"> * end of the textbox and selects the highlighted item, otherwise the container</span>
<span class="cm"> * is closed.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _jumpSelection</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_jumpSelection</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Triggered by up and down arrow keys, changes the current highlighted</span>
<span class="cm"> * &amp;lt;li&amp;gt; element item. Scrolls container if necessary.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _moveSelection</span>
<span class="cm"> * @param nKeyCode {Number} Code of key pressed.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_moveSelection</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">nKeyCode</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Determine current item&#39;s id number</span>
        <span class="kd">var</span> <span class="nx">elCurListItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span>
            <span class="nx">nCurItemIndex</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>

        <span class="k">if</span><span class="p">(</span><span class="nx">elCurListItem</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">nCurItemIndex</span> <span class="o">=</span> <span class="nx">elCurListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="kd">var</span> <span class="nx">nNewItemIndex</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">40</span><span class="p">)</span> <span class="o">?</span>
                <span class="p">(</span><span class="nx">nCurItemIndex</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">:</span> <span class="p">(</span><span class="nx">nCurItemIndex</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>

        <span class="c1">// Out of bounds</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">nNewItemIndex</span> <span class="o">&lt;</span> <span class="o">-</span><span class="mi">2</span> <span class="o">||</span> <span class="nx">nNewItemIndex</span> <span class="o">&gt;=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_nDisplayedItems</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="k">if</span><span class="p">(</span><span class="nx">elCurListItem</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Unhighlight current item</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elCurListItem</span><span class="p">,</span> <span class="s2">&quot;from&quot;</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowFromEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">elCurListItem</span><span class="p">);</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item arrowed from: &quot;</span> <span class="o">+</span> <span class="nx">elCurListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">nNewItemIndex</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
           <span class="c1">// Go back to query (remove type-ahead string)</span>
            <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sPastSelections</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">nNewItemIndex</span> <span class="o">==</span> <span class="o">-</span><span class="mi">2</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">// Close container</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="kd">var</span> <span class="nx">elNewListItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">[</span><span class="nx">nNewItemIndex</span><span class="p">],</span>

        <span class="c1">// Scroll the container if necessary</span>
            <span class="nx">elContent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">,</span>
            <span class="nx">sOF</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">getStyle</span><span class="p">(</span><span class="nx">elContent</span><span class="p">,</span><span class="s2">&quot;overflow&quot;</span><span class="p">),</span>
            <span class="nx">sOFY</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">getStyle</span><span class="p">(</span><span class="nx">elContent</span><span class="p">,</span><span class="s2">&quot;overflowY&quot;</span><span class="p">),</span>
            <span class="nx">scrollOn</span> <span class="o">=</span> <span class="p">((</span><span class="nx">sOF</span> <span class="o">==</span> <span class="s2">&quot;auto&quot;</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">sOF</span> <span class="o">==</span> <span class="s2">&quot;scroll&quot;</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">sOFY</span> <span class="o">==</span> <span class="s2">&quot;auto&quot;</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">sOFY</span> <span class="o">==</span> <span class="s2">&quot;scroll&quot;</span><span class="p">));</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">scrollOn</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">nNewItemIndex</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&amp;&amp;</span>
        <span class="p">(</span><span class="nx">nNewItemIndex</span> <span class="o">&lt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_nDisplayedItems</span><span class="p">))</span> <span class="p">{</span>
            <span class="c1">// User is keying down</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">40</span><span class="p">)</span> <span class="p">{</span>
                <span class="c1">// Bottom of selected item is below scroll area...</span>
                <span class="k">if</span><span class="p">((</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="o">+</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">)</span> <span class="o">&gt;</span> <span class="p">(</span><span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">+</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">))</span> <span class="p">{</span>
                    <span class="c1">// Set bottom of scroll area to bottom of selected item</span>
                    <span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="p">(</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="o">+</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">)</span> <span class="o">-</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
                <span class="p">}</span>
                <span class="c1">// Bottom of selected item is above scroll area...</span>
                <span class="k">else</span> <span class="k">if</span><span class="p">((</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="o">+</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">)</span> <span class="o">&lt;</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">)</span> <span class="p">{</span>
                    <span class="c1">// Set top of selected item to top of scroll area</span>
                    <span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="p">;</span>

                <span class="p">}</span>
            <span class="p">}</span>
            <span class="c1">// User is keying up</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="c1">// Top of selected item is above scroll area</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span> <span class="o">&lt;</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">)</span> <span class="p">{</span>
                    <span class="c1">// Set top of scroll area to top of selected item</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="p">;</span>
                <span class="p">}</span>
                <span class="c1">// Top of selected item is below scroll area</span>
                <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span> <span class="o">&gt;</span> <span class="p">(</span><span class="nx">elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">+</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">))</span> <span class="p">{</span>
                    <span class="c1">// Set bottom of selected item to bottom of scroll area</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_elContent</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="p">(</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetTop</span><span class="o">+</span><span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">)</span> <span class="o">-</span> <span class="nx">elContent</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">,</span> <span class="s2">&quot;to&quot;</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemArrowToEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">elNewListItem</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item arrowed to &quot;</span> <span class="o">+</span> <span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">typeAhead</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_updateValue</span><span class="p">(</span><span class="nx">elNewListItem</span><span class="p">);</span>
            <span class="c1">// Bug 2528552: Store as a selection</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_sCurQuery</span> <span class="o">=</span> <span class="nx">elNewListItem</span><span class="p">.</span><span class="nx">_sResultMatch</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Private event handlers</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * Handles container mouseover events.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onContainerMouseover</span>
<span class="cm"> * @param v {HTMLEvent} The mouseover event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onContainerMouseover</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
    <span class="kd">var</span> <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
    <span class="k">while</span><span class="p">(</span><span class="nx">elTarget</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">elTag</span> <span class="o">!=</span> <span class="s2">&quot;table&quot;</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">switch</span><span class="p">(</span><span class="nx">elTag</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">case</span> <span class="s2">&quot;body&quot;</span><span class="o">:</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;li&quot;</span><span class="o">:</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">prehighlightClassName</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_togglePrehighlight</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;mouseover&quot;</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;to&quot;</span><span class="p">);</span>
                <span class="p">}</span>
            
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">itemMouseOverEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">,</span> <span class="nx">elTarget</span><span class="p">);</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item moused over &quot;</span> <span class="o">+</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;div&quot;</span><span class="o">:</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;yui-ac-container&quot;</span><span class="p">))</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bOverContainer</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                    <span class="k">return</span><span class="p">;</span>
                <span class="p">}</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">default</span><span class="o">:</span>
                <span class="k">break</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles container mouseout events.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onContainerMouseout</span>
<span class="cm"> * @param v {HTMLEvent} The mouseout event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onContainerMouseout</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
    <span class="kd">var</span> <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
    <span class="k">while</span><span class="p">(</span><span class="nx">elTarget</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">elTag</span> <span class="o">!=</span> <span class="s2">&quot;table&quot;</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">switch</span><span class="p">(</span><span class="nx">elTag</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">case</span> <span class="s2">&quot;body&quot;</span><span class="o">:</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;li&quot;</span><span class="o">:</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">prehighlightClassName</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_togglePrehighlight</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;mouseout&quot;</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;from&quot;</span><span class="p">);</span>
                <span class="p">}</span>
            
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">itemMouseOutEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">,</span> <span class="nx">elTarget</span><span class="p">);</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item moused out &quot;</span> <span class="o">+</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">_nItemIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;ul&quot;</span><span class="o">:</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span><span class="s2">&quot;to&quot;</span><span class="p">);</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;div&quot;</span><span class="o">:</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;yui-ac-container&quot;</span><span class="p">))</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bOverContainer</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
                    <span class="k">return</span><span class="p">;</span>
                <span class="p">}</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">default</span><span class="o">:</span>
                <span class="k">break</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles container click events.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onContainerClick</span>
<span class="cm"> * @param v {HTMLEvent} The click event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onContainerClick</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
    <span class="kd">var</span> <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
    <span class="k">while</span><span class="p">(</span><span class="nx">elTarget</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">elTag</span> <span class="o">!=</span> <span class="s2">&quot;table&quot;</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">switch</span><span class="p">(</span><span class="nx">elTag</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">case</span> <span class="s2">&quot;body&quot;</span><span class="o">:</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="k">case</span> <span class="s2">&quot;li&quot;</span><span class="o">:</span>
                <span class="c1">// In case item has not been moused over</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">,</span><span class="s2">&quot;to&quot;</span><span class="p">);</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">);</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="k">default</span><span class="o">:</span>
                <span class="k">break</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">elTarget</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">elTarget</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">elTag</span> <span class="o">=</span> <span class="nx">elTarget</span><span class="p">.</span><span class="nx">nodeName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}</span>    
<span class="p">};</span>


<span class="cm">/**</span>
<span class="cm"> * Handles container scroll events.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onContainerScroll</span>
<span class="cm"> * @param v {HTMLEvent} The scroll event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onContainerScroll</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_focus</span><span class="p">();</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles container resize events.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onContainerResize</span>
<span class="cm"> * @param v {HTMLEvent} The resize event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onContainerResize</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainerHelpers</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">);</span>
<span class="p">};</span>


<span class="cm">/**</span>
<span class="cm"> * Handles textbox keydown events of functional keys, mainly for UI behavior.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onTextboxKeyDown</span>
<span class="cm"> * @param v {HTMLEvent} The keydown event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onTextboxKeyDown</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">nKeyCode</span> <span class="o">=</span> <span class="nx">v</span><span class="p">.</span><span class="nx">keyCode</span><span class="p">;</span>

    <span class="c1">// Clear timeout</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">clearTimeout</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nTypeAheadDelayID</span><span class="p">);</span>
    <span class="p">}</span>
    
    <span class="k">switch</span> <span class="p">(</span><span class="nx">nKeyCode</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">case</span> <span class="mi">9</span><span class="o">:</span> <span class="c1">// tab</span>
            <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">opera</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">userAgent</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;mac&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">webkit</span><span class="o">&gt;</span><span class="mi">420</span><span class="p">))</span> <span class="p">{</span>
                <span class="c1">// select an item or clear out</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">delimChar</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">!=</span> <span class="nx">nKeyCode</span><span class="p">))</span> <span class="p">{</span>
                        <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="k">case</span> <span class="mi">13</span><span class="o">:</span> <span class="c1">// enter</span>
            <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">opera</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">userAgent</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;mac&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">webkit</span><span class="o">&gt;</span><span class="mi">420</span><span class="p">))</span> <span class="p">{</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">!=</span> <span class="nx">nKeyCode</span><span class="p">)</span> <span class="p">{</span>
                        <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="k">case</span> <span class="mi">27</span><span class="o">:</span> <span class="c1">// esc</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="k">case</span> <span class="mi">39</span><span class="o">:</span> <span class="c1">// right</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_jumpSelection</span><span class="p">();</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="k">case</span> <span class="mi">38</span><span class="o">:</span> <span class="c1">// up</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_moveSelection</span><span class="p">(</span><span class="nx">nKeyCode</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="k">case</span> <span class="mi">40</span><span class="o">:</span> <span class="c1">// down</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_moveSelection</span><span class="p">(</span><span class="nx">nKeyCode</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">break</span><span class="p">;</span>
        <span class="k">default</span><span class="o">:</span> 
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bItemSelected</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleHighlight</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">,</span> <span class="s2">&quot;from&quot;</span><span class="p">);</span>

            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">textboxKeyEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">,</span> <span class="nx">nKeyCode</span><span class="p">);</span>
            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Textbox keyed&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            <span class="k">break</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">if</span><span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">===</span> <span class="mi">18</span><span class="p">){</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_enableIntervalDetection</span><span class="p">();</span>
    <span class="p">}</span>    
    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">=</span> <span class="nx">nKeyCode</span><span class="p">;</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles textbox keypress events.</span>
<span class="cm"> * @method _onTextboxKeyPress</span>
<span class="cm"> * @param v {HTMLEvent} The keypress event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onTextboxKeyPress</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">nKeyCode</span> <span class="o">=</span> <span class="nx">v</span><span class="p">.</span><span class="nx">keyCode</span><span class="p">;</span>

        <span class="c1">// Expose only to non SF3 (bug 1978549) Mac browsers (bug 790337) and  Opera browsers (bug 583531),</span>
        <span class="c1">// where stopEvent is ineffective on keydown events </span>
        <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">opera</span> <span class="o">||</span> <span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">userAgent</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;mac&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">.</span><span class="nx">webkit</span> <span class="o">&lt;</span> <span class="mi">420</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">switch</span> <span class="p">(</span><span class="nx">nKeyCode</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">case</span> <span class="mi">9</span><span class="o">:</span> <span class="c1">// tab</span>
                <span class="c1">// select an item or clear out</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">delimChar</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                    <span class="p">}</span>
                    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">);</span>
                    <span class="p">}</span>
                    <span class="k">else</span> <span class="p">{</span>
                        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">case</span> <span class="mi">13</span><span class="o">:</span> <span class="c1">// enter</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">stopEvent</span><span class="p">(</span><span class="nx">v</span><span class="p">);</span>
                    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elCurListItem</span><span class="p">);</span>
                    <span class="p">}</span>
                    <span class="k">else</span> <span class="p">{</span>
                        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="k">default</span><span class="o">:</span>
                <span class="k">break</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>

        <span class="c1">//TODO: (?) limit only to non-IE, non-Mac-FF for Korean IME support (bug 811948)</span>
        <span class="c1">// Korean IME detected</span>
        <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">nKeyCode</span> <span class="o">==</span> <span class="mi">229</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_enableIntervalDetection</span><span class="p">();</span>
        <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles textbox keyup events to trigger queries.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onTextboxKeyUp</span>
<span class="cm"> * @param v {HTMLEvent} The keyup event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onTextboxKeyUp</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">sText</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">value</span><span class="p">;</span> <span class="c1">//string in textbox</span>
    
    <span class="c1">// Check to see if any of the public properties have been updated</span>
    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_initProps</span><span class="p">();</span>

    <span class="c1">// Filter out chars that don&#39;t trigger queries</span>
    <span class="kd">var</span> <span class="nx">nKeyCode</span> <span class="o">=</span> <span class="nx">v</span><span class="p">.</span><span class="nx">keyCode</span><span class="p">;</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_isIgnoreKey</span><span class="p">(</span><span class="nx">nKeyCode</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// Clear previous timeout</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nDelayID</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">clearTimeout</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nDelayID</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="c1">// Set new timeout</span>
    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nDelayID</span> <span class="o">=</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sendQuery</span><span class="p">(</span><span class="nx">sText</span><span class="p">);</span>
        <span class="p">},(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">queryDelay</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles text input box receiving focus.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onTextboxFocus</span>
<span class="cm"> * @param v {HTMLEvent} The focus event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onTextboxFocus</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Start of a new interaction</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bFocused</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s2">&quot;autocomplete&quot;</span><span class="p">,</span><span class="s2">&quot;off&quot;</span><span class="p">);</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bFocused</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sInitInputValue</span> <span class="o">=</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">;</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">textboxFocusEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Textbox focused&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles text input box losing focus.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onTextboxBlur</span>
<span class="cm"> * @param v {HTMLEvent} The focus event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onTextboxBlur</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Is a true blur</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bOverContainer</span> <span class="o">||</span> <span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_nKeyCode</span> <span class="o">==</span> <span class="mi">9</span><span class="p">))</span> <span class="p">{</span>
        <span class="c1">// Current query needs to be validated as a selection</span>
        <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bItemSelected</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">elMatchListItem</span> <span class="o">=</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_textMatchesOption</span><span class="p">();</span>
            <span class="c1">// Container is closed or current query doesn&#39;t match any result</span>
            <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">||</span> <span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bContainerOpen</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">elMatchListItem</span> <span class="o">===</span> <span class="kc">null</span><span class="p">)))</span> <span class="p">{</span>
                <span class="c1">// Force selection is enabled so clear the current query</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">forceSelection</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_clearSelection</span><span class="p">();</span>
                <span class="p">}</span>
                <span class="c1">// Treat current query as a valid selection</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">unmatchedItemSelectEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sCurQuery</span><span class="p">);</span>
                    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Unmatched item selected: &quot;</span> <span class="o">+</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sCurQuery</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="c1">// Container is open and current query matches a result</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="c1">// Force a selection when textbox is blurred with a match</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">forceSelection</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_selectItem</span><span class="p">(</span><span class="nx">elMatchListItem</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span>

        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_clearInterval</span><span class="p">();</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_bFocused</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
        <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">.</span><span class="nx">_sInitInputValue</span> <span class="o">!==</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">value</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">oSelf</span><span class="p">.</span><span class="nx">textboxChangeEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">textboxBlurEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oSelf</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Textbox blurred&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_toggleContainer</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="c1">// Not a true blur if it was a selection via mouse click</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_focus</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * Handles window unload event.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _onWindowUnload</span>
<span class="cm"> * @param v {HTMLEvent} The unload event.</span>
<span class="cm"> * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_onWindowUnload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span><span class="nx">oSelf</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="nx">oSelf</span> <span class="o">&amp;&amp;</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span> <span class="o">&amp;&amp;</span> <span class="nx">oSelf</span><span class="p">.</span><span class="nx">allowBrowserAutocomplete</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oSelf</span><span class="p">.</span><span class="nx">_elTextbox</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s2">&quot;autocomplete&quot;</span><span class="p">,</span><span class="s2">&quot;on&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Deprecated for Backwards Compatibility</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////</span>
<span class="cm">/**</span>
<span class="cm"> * @method doBeforeSendQuery</span>
<span class="cm"> * @deprecated Use generateRequest.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">doBeforeSendQuery</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">generateRequest</span><span class="p">(</span><span class="nx">sQuery</span><span class="p">);</span>
<span class="p">};</span>

<span class="cm">/**</span>
<span class="cm"> * @method getListItems</span>
<span class="cm"> * @deprecated Use getListEl().childNodes.</span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getListItems</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">allListItemEls</span> <span class="o">=</span> <span class="p">[],</span>
        <span class="nx">els</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_elList</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">;</span>
    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="nx">els</span><span class="p">.</span><span class="nx">length</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span> <span class="nx">i</span><span class="o">&gt;=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">--</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">allListItemEls</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="nx">els</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
    <span class="p">}</span>
    <span class="k">return</span> <span class="nx">allListItemEls</span><span class="p">;</span>
<span class="p">};</span>

<span class="c1">/////////////////////////////////////////////////////////////////////////</span>
<span class="c1">//</span>
<span class="c1">// Private static methods</span>
<span class="c1">//</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////</span>

<span class="cm">/**</span>
<span class="cm"> * Clones object literal or array of object literals.</span>
<span class="cm"> *</span>
<span class="cm"> * @method AutoComplete._cloneObject</span>
<span class="cm"> * @param o {Object} Object.</span>
<span class="cm"> * @private</span>
<span class="cm"> * @static     </span>
<span class="cm"> */</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_cloneObject</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">o</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isValue</span><span class="p">(</span><span class="nx">o</span><span class="p">))</span> <span class="p">{</span>
        <span class="k">return</span> <span class="nx">o</span><span class="p">;</span>
    <span class="p">}</span>
    
    <span class="kd">var</span> <span class="nx">copy</span> <span class="o">=</span> <span class="p">{};</span>
    
    <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span><span class="nx">o</span><span class="p">))</span> <span class="p">{</span>
        <span class="nx">copy</span> <span class="o">=</span> <span class="nx">o</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">o</span><span class="p">))</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">array</span> <span class="o">=</span> <span class="p">[];</span>
        <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="nx">len</span><span class="o">=</span><span class="nx">o</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="p">;</span><span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">array</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_cloneObject</span><span class="p">(</span><span class="nx">o</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
        <span class="p">}</span>
        <span class="nx">copy</span> <span class="o">=</span> <span class="nx">array</span><span class="p">;</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">o</span><span class="p">))</span> <span class="p">{</span> 
        <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">x</span> <span class="k">in</span> <span class="nx">o</span><span class="p">){</span>
            <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="nx">o</span><span class="p">,</span> <span class="nx">x</span><span class="p">))</span> <span class="p">{</span>
                <span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isValue</span><span class="p">(</span><span class="nx">o</span><span class="p">[</span><span class="nx">x</span><span class="p">])</span> <span class="o">&amp;&amp;</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">o</span><span class="p">[</span><span class="nx">x</span><span class="p">])</span> <span class="o">||</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">o</span><span class="p">[</span><span class="nx">x</span><span class="p">]))</span> <span class="p">{</span>
                    <span class="nx">copy</span><span class="p">[</span><span class="nx">x</span><span class="p">]</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">AutoComplete</span><span class="p">.</span><span class="nx">_cloneObject</span><span class="p">(</span><span class="nx">o</span><span class="p">[</span><span class="nx">x</span><span class="p">]);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">copy</span><span class="p">[</span><span class="nx">x</span><span class="p">]</span> <span class="o">=</span> <span class="nx">o</span><span class="p">[</span><span class="nx">x</span><span class="p">];</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
        <span class="nx">copy</span> <span class="o">=</span> <span class="nx">o</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">copy</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>

                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_animation.html" title="animation">animation</a></li>
                                <li class="selected"><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
                                <li class=""><a href="module_button.html" title="button">button</a></li>
                                <li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
                                <li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
                                <li class=""><a href="module_charts.html" title="charts">charts</a></li>
                                <li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
                                <li class=""><a href="module_connection.html" title="connection">connection</a></li>
                                <li class=""><a href="module_container.html" title="container">container</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
                                <li class=""><a href="module_datemath.html" title="datemath">datemath</a></li>
                                <li class=""><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
                                <li class=""><a href="module_editor.html" title="editor">editor</a></li>
                                <li class=""><a href="module_element.html" title="element">element</a></li>
                                <li class=""><a href="module_element-delegate.html" title="element-delegate">element-delegate</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_event-delegate.html" title="event-delegate">event-delegate</a></li>
                                <li class=""><a href="module_event-mouseenter.html" title="event-mouseenter">event-mouseenter</a></li>
                                <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
                                <li class=""><a href="module_get.html" title="get">get</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_layout.html" title="layout">layout</a></li>
                                <li class=""><a href="module_logger.html" title="logger">logger</a></li>
                                <li class=""><a href="module_menu.html" title="menu">menu</a></li>
                                <li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
                                <li class=""><a href="module_progressbar.html" title="progressbar">progressbar</a></li>
                                <li class=""><a href="module_resize.html" title="resize">resize</a></li>
                                <li class=""><a href="module_selector.html" title="selector">selector</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_storage.html" title="Storage">Storage</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_swf.html" title="swf">swf</a></li>
                                <li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
                                <li class=""><a href="module_swfstore.html" title="swfstore">swfstore</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
                                <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
                                <li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
                                <li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
                                <li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.widget.AutoComplete.html" title="YAHOO.widget.AutoComplete">YAHOO.widget.AutoComplete</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class="selected"><a href="AutoComplete.js.html" title="AutoComplete.js">AutoComplete.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2011 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">

    var ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.widget.AutoComplete", "name": "allowBrowserAutocomplete", "url": "YAHOO.widget.AutoComplete.html#property_allowBrowserAutocomplete", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "alwaysShowContainer", "url": "YAHOO.widget.AutoComplete.html#property_alwaysShowContainer", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "animHoriz", "url": "YAHOO.widget.AutoComplete.html#property_animHoriz", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "animSpeed", "url": "YAHOO.widget.AutoComplete.html#property_animSpeed", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "animVert", "url": "YAHOO.widget.AutoComplete.html#property_animVert", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "applyLocalFilter", "url": "YAHOO.widget.AutoComplete.html#property_applyLocalFilter", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "AutoComplete._cloneObject", "url": "YAHOO.widget.AutoComplete.html#method_AutoComplete._cloneObject", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "autoHighlight", "url": "YAHOO.widget.AutoComplete.html#property_autoHighlight", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "autoSnapContainer", "url": "YAHOO.widget.AutoComplete.html#property_autoSnapContainer", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_bContainerOpen", "url": "YAHOO.widget.AutoComplete.html#property__bContainerOpen", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_bFocused", "url": "YAHOO.widget.AutoComplete.html#property__bFocused", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_bItemSelected", "url": "YAHOO.widget.AutoComplete.html#property__bItemSelected", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_bOverContainer", "url": "YAHOO.widget.AutoComplete.html#property__bOverContainer", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_clearInterval", "url": "YAHOO.widget.AutoComplete.html#method__clearInterval", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "clearList", "url": "YAHOO.widget.AutoComplete.html#method_clearList", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_clearSelection", "url": "YAHOO.widget.AutoComplete.html#method__clearSelection", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "collapseContainer", "url": "YAHOO.widget.AutoComplete.html#method_collapseContainer", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "containerCollapseEvent", "url": "YAHOO.widget.AutoComplete.html#event_containerCollapseEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "containerExpandEvent", "url": "YAHOO.widget.AutoComplete.html#event_containerExpandEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "containerPopulateEvent", "url": "YAHOO.widget.AutoComplete.html#event_containerPopulateEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "dataErrorEvent", "url": "YAHOO.widget.AutoComplete.html#event_dataErrorEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "dataRequestCancelEvent", "url": "YAHOO.widget.AutoComplete.html#event_dataRequestCancelEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "dataRequestEvent", "url": "YAHOO.widget.AutoComplete.html#event_dataRequestEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "dataReturnEvent", "url": "YAHOO.widget.AutoComplete.html#event_dataReturnEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "dataSource", "url": "YAHOO.widget.AutoComplete.html#property_dataSource", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "delimChar", "url": "YAHOO.widget.AutoComplete.html#property_delimChar", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "destroy", "url": "YAHOO.widget.AutoComplete.html#method_destroy", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_doBeforeExpandContainer", "url": "YAHOO.widget.AutoComplete.html#method__doBeforeExpandContainer", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "doBeforeExpandContainer", "url": "YAHOO.widget.AutoComplete.html#method_doBeforeExpandContainer", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "doBeforeLoadData", "url": "YAHOO.widget.AutoComplete.html#method_doBeforeLoadData", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "doBeforeSendQuery", "url": "YAHOO.widget.AutoComplete.html#method_doBeforeSendQuery", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elBody", "url": "YAHOO.widget.AutoComplete.html#property__elBody", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elContainer", "url": "YAHOO.widget.AutoComplete.html#property__elContainer", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elContent", "url": "YAHOO.widget.AutoComplete.html#property__elContent", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elCurListItem", "url": "YAHOO.widget.AutoComplete.html#property__elCurListItem", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elCurPrehighlightItem", "url": "YAHOO.widget.AutoComplete.html#property__elCurPrehighlightItem", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elFooter", "url": "YAHOO.widget.AutoComplete.html#property__elFooter", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elHeader", "url": "YAHOO.widget.AutoComplete.html#property__elHeader", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elIFrame", "url": "YAHOO.widget.AutoComplete.html#property__elIFrame", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elList", "url": "YAHOO.widget.AutoComplete.html#property__elList", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elShadow", "url": "YAHOO.widget.AutoComplete.html#property__elShadow", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_elTextbox", "url": "YAHOO.widget.AutoComplete.html#property__elTextbox", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_enableIntervalDetection", "url": "YAHOO.widget.AutoComplete.html#method__enableIntervalDetection", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "enableIntervalDetection", "url": "YAHOO.widget.AutoComplete.html#method_enableIntervalDetection", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "expandContainer", "url": "YAHOO.widget.AutoComplete.html#method_expandContainer", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_extractQuery", "url": "YAHOO.widget.AutoComplete.html#method__extractQuery", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "filterResults", "url": "YAHOO.widget.AutoComplete.html#method_filterResults", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_focus", "url": "YAHOO.widget.AutoComplete.html#method__focus", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "forceSelection", "url": "YAHOO.widget.AutoComplete.html#property_forceSelection", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "formatEscapedResult", "url": "YAHOO.widget.AutoComplete.html#method_formatEscapedResult", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "formatResult", "url": "YAHOO.widget.AutoComplete.html#method_formatResult", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "generateRequest", "url": "YAHOO.widget.AutoComplete.html#method_generateRequest", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getContainerEl", "url": "YAHOO.widget.AutoComplete.html#method_getContainerEl", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getInputEl", "url": "YAHOO.widget.AutoComplete.html#method_getInputEl", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getListEl", "url": "YAHOO.widget.AutoComplete.html#method_getListEl", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getListItemData", "url": "YAHOO.widget.AutoComplete.html#method_getListItemData", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getListItemIndex", "url": "YAHOO.widget.AutoComplete.html#method_getListItemIndex", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getListItemMatch", "url": "YAHOO.widget.AutoComplete.html#method_getListItemMatch", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getListItems", "url": "YAHOO.widget.AutoComplete.html#method_getListItems", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "getSubsetMatches", "url": "YAHOO.widget.AutoComplete.html#method_getSubsetMatches", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "handleResponse", "url": "YAHOO.widget.AutoComplete.html#method_handleResponse", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "highlightClassName", "url": "YAHOO.widget.AutoComplete.html#property_highlightClassName", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_iFrameSrc", "url": "YAHOO.widget.AutoComplete.html#property__iFrameSrc", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_initContainerEl", "url": "YAHOO.widget.AutoComplete.html#method__initContainerEl", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_initContainerHelperEls", "url": "YAHOO.widget.AutoComplete.html#method__initContainerHelperEls", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_initListEl", "url": "YAHOO.widget.AutoComplete.html#method__initListEl", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "__initProps", "url": "YAHOO.widget.AutoComplete.html#method___initProps", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "isContainerOpen", "url": "YAHOO.widget.AutoComplete.html#method_isContainerOpen", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "isFocused", "url": "YAHOO.widget.AutoComplete.html#method_isFocused", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_isIgnoreKey", "url": "YAHOO.widget.AutoComplete.html#method__isIgnoreKey", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "itemArrowFromEvent", "url": "YAHOO.widget.AutoComplete.html#event_itemArrowFromEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "itemArrowToEvent", "url": "YAHOO.widget.AutoComplete.html#event_itemArrowToEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "itemMouseOutEvent", "url": "YAHOO.widget.AutoComplete.html#event_itemMouseOutEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "itemMouseOverEvent", "url": "YAHOO.widget.AutoComplete.html#event_itemMouseOverEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "itemSelectEvent", "url": "YAHOO.widget.AutoComplete.html#event_itemSelectEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_jumpSelection", "url": "YAHOO.widget.AutoComplete.html#method__jumpSelection", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "maxResultsDisplayed", "url": "YAHOO.widget.AutoComplete.html#property_maxResultsDisplayed", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "minQueryLength", "url": "YAHOO.widget.AutoComplete.html#property_minQueryLength", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_moveSelection", "url": "YAHOO.widget.AutoComplete.html#method__moveSelection", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_nDelayID", "url": "YAHOO.widget.AutoComplete.html#property__nDelayID", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_nDisplayedItems", "url": "YAHOO.widget.AutoComplete.html#property__nDisplayedItems", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_nIndex", "url": "YAHOO.widget.AutoComplete.html#property__nIndex", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_nKeyCode", "url": "YAHOO.widget.AutoComplete.html#property__nKeyCode", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_nTypeAheadDelayID", "url": "YAHOO.widget.AutoComplete.html#property__nTypeAheadDelayID", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_oAnim", "url": "YAHOO.widget.AutoComplete.html#property__oAnim", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onContainerClick", "url": "YAHOO.widget.AutoComplete.html#method__onContainerClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onContainerMouseout", "url": "YAHOO.widget.AutoComplete.html#method__onContainerMouseout", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onContainerMouseover", "url": "YAHOO.widget.AutoComplete.html#method__onContainerMouseover", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onContainerResize", "url": "YAHOO.widget.AutoComplete.html#method__onContainerResize", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onContainerScroll", "url": "YAHOO.widget.AutoComplete.html#method__onContainerScroll", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onInterval", "url": "YAHOO.widget.AutoComplete.html#method__onInterval", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onTextboxBlur", "url": "YAHOO.widget.AutoComplete.html#method__onTextboxBlur", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onTextboxFocus", "url": "YAHOO.widget.AutoComplete.html#method__onTextboxFocus", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onTextboxKeyDown", "url": "YAHOO.widget.AutoComplete.html#method__onTextboxKeyDown", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onTextboxKeyPress", "url": "YAHOO.widget.AutoComplete.html#method__onTextboxKeyPress", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onTextboxKeyUp", "url": "YAHOO.widget.AutoComplete.html#method__onTextboxKeyUp", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_onWindowUnload", "url": "YAHOO.widget.AutoComplete.html#method__onWindowUnload", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_populateList", "url": "YAHOO.widget.AutoComplete.html#method__populateList", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_populateListItem", "url": "YAHOO.widget.AutoComplete.html#method__populateListItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "prehighlightClassName", "url": "YAHOO.widget.AutoComplete.html#property_prehighlightClassName", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "preparseRawResponse", "url": "YAHOO.widget.AutoComplete.html#method_preparseRawResponse", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryDelay", "url": "YAHOO.widget.AutoComplete.html#property_queryDelay", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_queryInterval", "url": "YAHOO.widget.AutoComplete.html#property__queryInterval", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryInterval", "url": "YAHOO.widget.AutoComplete.html#property_queryInterval", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryMatchCase", "url": "YAHOO.widget.AutoComplete.html#property_queryMatchCase", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryMatchContains", "url": "YAHOO.widget.AutoComplete.html#property_queryMatchContains", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryMatchSubset", "url": "YAHOO.widget.AutoComplete.html#property_queryMatchSubset", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "queryQuestionMark", "url": "YAHOO.widget.AutoComplete.html#property_queryQuestionMark", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "resultTypeList", "url": "YAHOO.widget.AutoComplete.html#property_resultTypeList", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sCurQuery", "url": "YAHOO.widget.AutoComplete.html#property__sCurQuery", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "selectionEnforceEvent", "url": "YAHOO.widget.AutoComplete.html#event_selectionEnforceEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_selectItem", "url": "YAHOO.widget.AutoComplete.html#method__selectItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_selectText", "url": "YAHOO.widget.AutoComplete.html#method__selectText", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sendQuery", "url": "YAHOO.widget.AutoComplete.html#method__sendQuery", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "sendQuery", "url": "YAHOO.widget.AutoComplete.html#method_sendQuery", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "setBody", "url": "YAHOO.widget.AutoComplete.html#method_setBody", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "setFooter", "url": "YAHOO.widget.AutoComplete.html#method_setFooter", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "setHeader", "url": "YAHOO.widget.AutoComplete.html#method_setHeader", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sInitInputValue", "url": "YAHOO.widget.AutoComplete.html#property__sInitInputValue", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sLastTextboxValue", "url": "YAHOO.widget.AutoComplete.html#event__sLastTextboxValue", "type": "event"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sName", "url": "YAHOO.widget.AutoComplete.html#property__sName", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "snapContainer", "url": "YAHOO.widget.AutoComplete.html#method_snapContainer", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_sPastSelections", "url": "YAHOO.widget.AutoComplete.html#property__sPastSelections", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "suppressInputUpdate", "url": "YAHOO.widget.AutoComplete.html#property_suppressInputUpdate", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "textboxBlurEvent", "url": "YAHOO.widget.AutoComplete.html#event_textboxBlurEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "textboxChangeEvent", "url": "YAHOO.widget.AutoComplete.html#event_textboxChangeEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "textboxFocusEvent", "url": "YAHOO.widget.AutoComplete.html#event_textboxFocusEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "textboxKeyEvent", "url": "YAHOO.widget.AutoComplete.html#event_textboxKeyEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_textMatchesOption", "url": "YAHOO.widget.AutoComplete.html#method__textMatchesOption", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_toggleContainer", "url": "YAHOO.widget.AutoComplete.html#method__toggleContainer", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_toggleContainerHelpers", "url": "YAHOO.widget.AutoComplete.html#method__toggleContainerHelpers", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_toggleHighlight", "url": "YAHOO.widget.AutoComplete.html#method__toggleHighlight", "type": "method"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_togglePrehighlight", "url": "YAHOO.widget.AutoComplete.html#method__togglePrehighlight", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "toString", "url": "YAHOO.widget.AutoComplete.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "typeAhead", "url": "YAHOO.widget.AutoComplete.html#property_typeAhead", "type": "property"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_typeAhead", "url": "YAHOO.widget.AutoComplete.html#method__typeAhead", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "typeAheadDelay", "url": "YAHOO.widget.AutoComplete.html#property_typeAheadDelay", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "typeAheadEvent", "url": "YAHOO.widget.AutoComplete.html#event_typeAheadEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "unmatchedItemSelectEvent", "url": "YAHOO.widget.AutoComplete.html#event_unmatchedItemSelectEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.AutoComplete", "name": "_updateValue", "url": "YAHOO.widget.AutoComplete.html#method__updateValue", "type": "method"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "useIFrame", "url": "YAHOO.widget.AutoComplete.html#property_useIFrame", "type": "property"}, {"access": "", "host": "YAHOO.widget.AutoComplete", "name": "useShadow", "url": "YAHOO.widget.AutoComplete.html#property_useShadow", "type": "property"}];
</script>
</body>
</html>
